coding180 icon

What is the process of using ~ get home directory in Python?

Home > Interviews > Python

robort - 2022-08-29 15:53:32

os The module needs to be imported, and then just one line does the rest.

import os
print (os.path.expanduser('~'))

The results are as follows:



Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel