Skip to content

Instantly share code, notes, and snippets.

@ZhouYang1993
Created April 24, 2020 21:22
Show Gist options
  • Save ZhouYang1993/ee4350059b58d4c0dacd2b1ad1619ddb to your computer and use it in GitHub Desktop.
Save ZhouYang1993/ee4350059b58d4c0dacd2b1ad1619ddb to your computer and use it in GitHub Desktop.
File Handling in Python
# The contents in test.txt are:
# Hello,Yang!
with open('test.txt', 'r+') as f:
print(f.read())
f.seek(6, 0)
print(f.read())
# Hello,Yang!
# Yang!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment