How to get home directory using ~ in Python

1 Answer

0 votes
import os

home_dir = str(os.path.expanduser('~'))

print(home_dir)


'''
run:

d:\python

'''

 



answered Sep 25, 2019 by avibootz
...