如何逐行阅读大文本文件并进行处理?

时间:2018-12-17 10:42:00

标签: python word2vec

文件看起来像这样

   637   C0205088:Terminal (End-stage) [Qualitative Concept]
   637   C0439095:Alpha (Greek letter alpha (qualifier value)) [Intellectual Product]
   840   C0596072:amino group [Inorganic Chemical] 

1 个答案:

答案 0 :(得分:0)

尝试以下代码:

with open(r"filepath" , 'rb') as fp:
    for line in fp:
        print line.strip()