I wish to read a large data file (file size is around 1.8 MB) and manipulate the data in this file. Just reading and writing the first 500 lines of this file is causing a problem. I wrote:<br><br>fin = open(&#39;gene-GS00471-DNA_B01_1101_37-ASM.tsv&#39;)<br>
count = 0<br>for i in fin.readlines():<br>    print i<br>    count += 1<br>    if count &gt;= 500:<br>        break<br><br>and got this error msg:<br><br>Traceback (most recent call last):<br>  File &quot;H:\genome_4_omics_study\GS000003696-DID\GS00471-DNA_B01_1101_37-ASM\GS00471-DNA_B01\ASM\gene-GS00471-DNA_B01_1101_37-ASM.tsv\test.py&quot;, line 3, in &lt;module&gt;<br>
    for i in fin.readlines():<br>MemoryError<br><br>-------<br><span dir="ltr" id=":3a">is there a way to stop python from slurping all the  file contents at once</span>?<br><br><br><br><br>