with open('Passwords.txt') as passwords: for line in passwords: print(line)
我刚刚输入了这个代码,它给了我
FileNotFoundError: [Errno 2] No such file or directory: 'Passwords.txt'
我确信这个文件和我把python文件放在同一个文件夹中。这就是证据:文件在同一个文件夹中
rta7y2nd1#
您应该首先输入完整路径,下面是一个示例:
with open(r'/home/user/Documents/Passwords.txt') as passwords: # and don't forget this content = passwords.readlines() for line in passwords: print(line)
1条答案
按热度按时间rta7y2nd1#
您应该首先输入完整路径,下面是一个示例: