1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How do I convert a Windows UNC path to a mapped drive letter path with Python?

Discussão em 'Python' iniciado por Stack, Setembro 12, 2025.

  1. Stack

    Stack Membro Participativo

    I've seen the reverse of this question asked a lot but can't find info on this one.

    A set of subprocesses I'm running in a script want Windows drive-letter paths (M:\Some\Path\file.txt instead of \\my.subnet\someplace\Some\Path\file.txt), but the UNC path is presented as an earlier input (which I don't have control over).

    I am familiar with the pathlib.Path.drive function, which gives me \\my.subnet\subnet, but how would I get from that to the drive letter?

    Continue reading...

Compartilhe esta Página