想写个python脚本实现 输入的文件名,查文件有多少行 ,不知道哪里错了。。
#!/usr/bin/python
aaa=input()
print("the file is ", aaa)
f = open('aaa')
iter_f = iter(f)
lines=0
for line in iter_f:
lines += 1
print("is", lines)
运行结果报错: [root@host36 ~]# python test.py 1.txt Traceback (most recent call last): File "test.py", line 2, in <module> aaa=input() File "<string>", line 1 1.txt ^ SyntaxError: unexpected EOF while parsing [root@host36 ~]#