The following code is going to lazily print the contents of the text file line by line, with each print stopping at '/n' .
with open('eggs.txt', 'rb') as file:
for line in file:
print line
Is there any configuration to lazily print the contents of a text file, with each print stopping at ', ' ?
(or any other character/string )
I am asking this because I am trying to read a file which contains one single 2.9 GB long line separated by commas.
PS. My question is different than this one: Read large text files in Python, line by line without loading it in to memory I am asking how to do the stopping at characters other than newlines ('\n')