我试图从.txt文件中提取特定信息。我已经想出了一种方法来隔离我需要的线条;但是,打印它们被证明是有问题的。在
with open('RCSV.txt','r') as RCSV:
for line in RCSV.read().splitlines():
if line.startswith(' THETA'):
print(line.next())
当我使用line.next()
时,会出现以下错误:
Here is a link to the .txt file
Here is a link to the area of the file in question
我要做的是提取出以θφ开头的那条线
您可以使用
next(input)
,作为:你可以试试这个:
注意,在下一次迭代中,
line
将是next_line
之后的一行。在找到键后,可以使用标志获取所有行。在
例如:
或者如果你只需要下面的一行。在
^{pr2}$相关问题 更多 >
编程相关推荐