Created
December 15, 2014 05:01
-
-
Save bwarren2/d9be188ebb93cdc06daf to your computer and use it in GitHub Desktop.
This file contains 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
ben@Watt:~$ python | |
Python 2.7.5+ (default, Feb 27 2014, 19:37:08) | |
[GCC 4.8.1] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> with open('foobar.txt', 'r') as f: | |
... data = f.read() | |
... | |
>>> data | |
'\n\n# I can totally write C, and just have elected not to here! (Not really.)\n' | |
>>> with open('foobar.txt', 'w') as f: | |
... f.write('#Definitely a copyright notice') | |
... f.write(data) | |
... | |
>>> with open('foobar.txt', 'r') as f: | |
... contents = f.read() | |
... | |
>>> contents | |
'#Definitely a copyright notice\n\n# I can totally write C, and just have elected not to here! (Not really.)\n' | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment