Guest User

Untitled

a guest
Aug 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. myFileName = "foo.html"
  2.  
  3. # The file() function returns a file object that you can write to.
  4. # In this case, we assign it to the fp variable.
  5. fp = file(myFileName, "w")
  6.  
  7. # This is some data we want to write out.
  8. var1 = "abc"
  9.  
  10. # When we do print >>fp, it's just like printing normally,
  11. # except all the output goes to the file object.
  12. print >>fp, '''<html>''', var1, '''</html>'''
  13.  
  14. fp.close()
Add Comment
Please, Sign In to add comment