Python users can not use the directory "~" Get Ubuntu system

After tests found: Python can not use "~" Get Ubuntu system's user directory,

Test code is as follows:

if os.path.isdir("~"):
    print("exists")

 

Published 277 original articles · won praise 76 · Views 300,000 +

Guess you like

Origin blog.csdn.net/songyuc/article/details/104222206