How to use os.path.expanduser (path) of Python
This article introduces the knowledge of "how to use Python's os.path.expanduser (path)". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32Type "help", "copyright" "credits" or "license ()" for more information. > > import os > path = r "F:\ python official document\ python-3.7.9-docs-pdf-a4\ docs-pdf\ library.pdf" > os.path.expanduser (path)'F:\\ python official document\\ python-3.7.9-docs-pdf-a4\\ docs-pdf\ library.pdf' > > path = r "~ F:\ python official document" > > os.path.expanduser (path) )'F:\\ python official document'> path = "F:/python official document / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf" > path'F:/python official document / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf' > os.path.expanduser (path) 'F:/python official document / python-3.7.9-docs-pdf-a4/docs-pdf/library .pdf'> path = "python official document / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf" > os.path.expanduser (path) 'python official document / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf' > path = "~ python official document / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf" > os.path.expanduser (path)' C:\\ Users\\ python official documents / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf' > path = "~ userpython official documents / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf" > > os.path.expanduser (path)'C:\\ Users\\ userpython official documents / python-3.7.9-docs-pdf-a4/docs-pdf/library.pdf' > os.path.expanduser ('~') )'C:\\ Users\\ chenxuqi' > os.path.expanduser ('~ aaa')'C:\\ Users\\ aaa' > os.path.expanduser ('~ user')'C:\\ Users\\ user' > os.path.expanduser ('~ chenxuqi')'C:\\ Users\\ chenxuqi' > > os.path.expanduser ('~')'C:\\ Users\\ chenxuqi' > > os.path.expanduser ('~')'C:\\ Users\'> > os .path.expanduser ('~ user')'C:\\ Users\\ user' > "how to use os.path.expanduser (path) of Python" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!