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

▼ Show 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
Python
Learn More with Madanswer

Related questions

0 votes
asked May 23, 2020 in Python by sharadyadav1986
...