How to get Desktop location?

后端 未结 7 666
情深已故
情深已故 2020-12-08 15:30

I\'m using Python on Windows and I want a part of my script to copy a file from a certain directory (I know its path) to the Desktop.

I used this:

sh         


        
7条回答
  •  暖寄归人
    2020-12-08 16:05

    For 3.5+ you can use pathlib:

    import pathlib
    
    desktop = pathlib.Path.home() / 'Desktop'
    

提交回复
热议问题