0 votes
in Python by
What’s The Process To Get The Home Directory Using ‘~’ In Python?

1 Answer

0 votes
by
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
...