Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # with open('xampp/passwords.txt') as f:
- # Если запустить скрипт из командной строки, то файл не будет найден:
- # C:\Users\Сергей>python d:\\test.py
- # Traceback (most recent call last):
- # File "d:\\test.py", line 1, in <module>
- # with open('xampp/passwords.txt') as f:
- # FileNotFoundError: [Errno 2] No such file or directory: 'xampp/passwords.txt'
- import os.path
- cur_dir = os.path.dirname(os.path.realpath(__file__))
- with open(os.path.join(cur_dir, 'xampp/passwords.txt')) as f:
- print(f.read())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement