Last active
August 10, 2016 18:26
-
-
Save TwiN/74e0a464ac2b45cb5eec1aa03b4ae313 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # overwrite fname | |
| def writeInFile(fname, data): | |
| fhandler = open(fname, "w") | |
| fhandler.write(data) | |
| fhandler.close() | |
| # append to new line in fname | |
| def writeInFile(fname, data): | |
| fhandler = open(fname, "a") | |
| fhandler.write(data.replace('\n', '')+'\n') # make sure newline, but not 2 | |
| fhandler.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment