以下是我用Python编写的代码:
import os
path=os.path.abspath("C:\Users\punagpal\Downloads\curl-7.50.3-win64-mingw\curl-7.50.3-win64-mingw\10.42.129.78_administrator_LogTasks.xml")
f = open(path,'r')
while True:
text = f.readline()
if 'name' in text:
print text
但是收到以下错误:
Invalid file open mode "IOError: [Errno 22] invalid mode ('r') or filename:"
答案 0 :(得分:0)
您需要转义反斜杠(char
)字符:
\