# Demonstrated Python Program
# to read file character by character
file = open('file.txt', 'r')
while 1:
# read by character
char = file.read(1)
if not char:
break
print(char)
file.close()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter