Advertisement
python_notes

Create file & Write to a file

May 8th, 2015
503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. #  Create file & Write to a file
  2.  
  3.  
  4.  
  5. Create a file called ourtest.txt with the contents "our file"
  6.  
  7.  
  8. myFile = open('/home/user/Documents/ourtest.txt', 'w')
  9.  
  10. myFile.write('our test')
  11.  
  12.  
  13.  
  14.  
  15. .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement