Skip to content

Instantly share code, notes, and snippets.

@KrisYu
Last active November 1, 2021 17:07
Show Gist options
  • Save KrisYu/207f44c681634cefdbf2afc909b93f51 to your computer and use it in GitHub Desktop.
Save KrisYu/207f44c681634cefdbf2afc909b93f51 to your computer and use it in GitHub Desktop.
read and write file
with open('filename') as f:
lines = f.readlines()
with open('write','w') as f:
f.write('Hello\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment