Python writing & reading text 08-03-2014, 05:17 PM
#1
Hello All,
Just wanted to share this simple snippet of code which allows you to read & write text files in Python, it's really easy and you have no need to import any librarys.
Just wanted to share this simple snippet of code which allows you to read & write text files in Python, it's really easy and you have no need to import any librarys.
Code:
#!/usr/bin/python
f = open('HC.log', 'w')
f.write('Hello my name is Lynux!\n')
f.write('Welcome to HackCommunity!')
f.close()
f = open('HC.log', 'r')
print f.read()Donations for Alcohol, Hookers & MJ: 1PzvkR3E3RvEMrcsuFV4AWAzWbum7mtVdZ


![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)

![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)
![[Image: iQ3pcQu.png]](http://i.imgur.com/iQ3pcQu.png)