Can anyone tell me how can I do this?
with open(filename) as f: while True: c = f.read(1) if not c: print "End of file" break print "Read a character:", c
I'm used to doing print >>f, "hi there" However, it seems that print >> is getting deprecated. What is the recommended way to do the line above? Update: Regarding all those answers with "\n"...is this universal …
How do I delete a file or folder in Python?
How can I find all the files in a directory having the extension .txt in python?