with open(filename) as f:
while True:
c = f.read(1)
if not c:
print "End of file"
break
print "Read a character:", c
More Related Contents:
- How can I read a single character at a time from a file in Python?
- How do I delete a file or folder in Python?
- Lazy Method for Reading Big File in Python?
- Reading binary file and looping over each byte
- How do I concatenate text files in Python?
- Is it possible to modify lines in a file in-place?
- open() gives FileNotFoundError/IOError: Errno 2 No such file or directory
- How to open a file using the open with statement
- Reading from a frequently updated file
- How to write a multidimensional array to a text file?
- Read file from line 2 or skip header row
- Python 32-bit memory limits on 64bit windows
- Python read JSON file and modify
- Writing a list to a file with Python, with newlines
- Read from a log file as it’s being written using python
- File read using “open()” vs “with open()” [duplicate]
- In Python, how to check if a string only contains certain characters?
- Create file but if name exists add number
- How to open a password protected excel file using python?
- pandas to_csv output quoting issue
- Python Pandas: How to read only first n rows of CSV files in?
- How to safely open/close files in python 2.4
- python close file descriptor question
- ValueError : I/O operation on closed file
- Trying to use open(filename, ‘w’ ) gives IOError: [Errno 2] No such file or directory if directory doesn’t exist
- Behaviour of truncate() method in Python
- How to read lines from a file in python starting from the end
- Convert percent string to float in pandas read_csv
- “OSError: [Errno 17] File exists” when trying to use os.makedirs [duplicate]
- Saving response from Requests to file