Dec 22, 2019 in Python
Q: What’s The Process To Get The Home Directory Using ‘~’ In Python?

1 Answer

0 votes
Dec 22, 2019
You need to import the os module, and then just a single line would do the rest.

import os

print (os.path.expanduser('~'))

Output:

/home/runner

Related questions

0 votes
Apr 5, 2020 in Docker
0 votes
Oct 12 in Python
...