Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myFileName = "foo.html"
- # The file() function returns a file object that you can write to.
- # In this case, we assign it to the fp variable.
- fp = file(myFileName, "w")
- # This is some data we want to write out.
- var1 = "abc"
- # When we do print >>fp, it's just like printing normally,
- # except all the output goes to the file object.
- print >>fp, '''<html>''', var1, '''</html>'''
- fp.close()
Add Comment
Please, Sign In to add comment