Python: How to read huge text file into memory

前端 未结 6 1054
自闭症患者
自闭症患者 2020-11-29 21:36

I\'m using Python 2.6 on a Mac Mini with 1GB RAM. I want to read in a huge text file

$ ls -l links.csv; file links.csv; tail links.csv 
-rw-r--r--  1 user  u         


        
6条回答
  •  心在旅途
    2020-11-29 22:11

    Since these are all just numbers, loading them into an Nx2 array would remove some overhead. Use NumPy for multidimensional arrays. Alternatively, you could use two normal python arrays to represent each column.

提交回复
热议问题