Login
Remember
Register
Ask a Question
What’s The Process To Get The Home Directory Using ‘~’ In Python?
0
votes
asked
Dec 22, 2019
in
Python
by
rajeshsharma
What’s The Process To Get The Home Directory Using ‘~’ In Python?
#python-directory
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Dec 22, 2019
by
sharadyadav1986
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
...