The fastest way to read input in Python

后端 未结 6 1560
孤街浪徒
孤街浪徒 2020-11-27 07:56

I want to read a huge text file that contains list of lists of integers. Now I\'m doing the following:

G = []
with open(\"test.txt\", \'r\') as f:
    for li         


        
6条回答
  •  轮回少年
    2020-11-27 08:16

    You might also try to bring the data into a database via bulk-insert, then processing your records with set operations. Depending on what you have to do, that may be faster, as bulk-insert software is optimized for this type of task.

提交回复
热议问题