Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What’s The Process To Get The Home Directory Using ‘~’ In Python?
Home
Python
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
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
0
votes
Q: Does The Functions Help() And Dir() List The Names Of All The Built_in Functions And Variables in Python? If No, How Would You List Them in Python?
asked
Jun 28, 2020
in
Python
by
Robindeniel
#python-help
#python-dir
#python-directory
#dir-python
#python-built-in-functions
#python-variables
Python-questions-answers
0
votes
Q: What's the cycle to get the home index utilizing '~' in Python Language?
asked
Aug 29, 2020
in
Python
by
Robindeniel
#python-utilization
Python-questions-answers
0
votes
Q: Explain how is it possible to Get the Google cache age of any URL or webpage using Python.
asked
Oct 11, 2021
in
Python
by
rajeshsharma
google-cache
Python-questions-answers
0
votes
Q: You are having multiple Memcache servers running Python, in which one of the memcacher server fails, and it has your data, will it ever try to get key data from that one failed server?
asked
Jan 2, 2021
in
Python
by
SakshiSharma
#python-memcache
Python-questions-answers
+1
vote
Q: How can you get a random number in python?
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-random-number
random-number
python
Python-questions-answers
0
votes
Q: What do you understand by the process of compilation and linking in Python?
asked
Oct 12, 2021
in
Python
by
rajeshsharma
compilation-process
linking-process
Python-questions-answers
0
votes
Q: How to Generate Color Spectrum using Python
asked
Mar 11, 2021
in
Python
by
rajeshsharma
color-spectrum
python-spectrum
Python-questions-answers
0
votes
Q: When using the Python shell and code block, what triggers the interpreter to begin evaluating a block of code?
asked
Jun 24, 2020
in
Python
by
Robindeniel
#python-shell
#python-code-block
#python-triggers
#python-interpreter
Python-questions-answers
0
votes
Q: How to save an image locally using Python in which we already know the URL address?
asked
May 23, 2020
in
Python
by
sharadyadav1986
#python-url-address
#pthon-save-image
#save-image-python
Python-questions-answers
0
votes
Q: Python has something called the dictionary. Explain using an example.
asked
Oct 12, 2021
in
Python
by
rajeshsharma
python-dictionary
Python-questions-answers
...