Open a file and read char by char : File Read : File PYTHON examples


PYTHON examples » File » File Read »

 

Open a file and read char by char



file = open('test.txt', 'r')
print file.read()

while 1:
    char = file.read(1)          # read by character
    if not charbreak
    print char,

file.close()
           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo File
» File Read