我收到一条关于我的python代码没有这样的文件或目录的错误消息。我将文件保存在台式计算机上。但是我收到了错误消息
#!/usr/bin/python
fh=open("C:/Users/****/Desktop/IP Data","r")
for line in fh.readlines():
line = line.strip()
words = line.split()
# increase counters
for word in words:
if len(words)>3:
if "IP" in words[1]:
print '%s\t%s' % (words[2],1)
答案 0 :(得分:0)
我认为你需要在windows中使用反斜杠。尝试更改为C:\\Users\\***\\Desktop\\IP Data