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

Related questions

+1 vote
asked Feb 15, 2021 in Python by SakshiSharma
0 votes
asked Oct 12, 2021 in Python by rajeshsharma
...