python version: 3.8 OS: Manjaro KDE
When I called os.listdir('/home/user_name')
, it worked fine.
However, when I called os.listdir('~')
, it threw FileNotFoundError: [Errno 2] No such file or directory: '~'
.
Why os.listdir
failed to understand ~
?