[Python] How do I start the file path from the users directory?

Discussão em 'Python' iniciado por Stack, Dezembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to create a script in python that creates a text file on the user's desktop. I need this to work on both Mac and Windows but it doesn't need to be in the same script as I have one script for mac and one for Windows. I can't seem to find a way for python to create a file with the path beginning at the user's directory (like ~/ for Linux) as I don't know the user's username. Thanks for any help!

    Continue reading...

Compartilhe esta Página