Best method for reading newline delimited files and discarding the newlines?

后端 未结 7 1081
孤城傲影
孤城傲影 2020-11-28 03:07

I am trying to determine the best way to handle getting rid of newlines when reading in newline delimited files in Python.

What I\'ve come up with is the following c

相关标签:
7条回答
  • 2020-11-28 04:10
    for line in file('/tmp/foo'):
        print line.strip('\n')
    
    0 讨论(0)
提交回复
热议问题