Read 50 characters at a time from a file and append each chunk to a string to rebuild the original. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Read 50 characters at a time from a file and append each chunk to a string to rebuild the original.

Write a program in Python.....

12th Apr 2019, 10:34 AM
Misal Chugh
Misal Chugh - avatar
1 Answer
+ 4
with open(file_name) as f: while True: c = f.read(50) if not c: print "End of file" break String += c
12th Apr 2019, 6:15 PM
Animesh Singh
Animesh Singh - avatar