Windows path in Python

后端 未结 5 1739
悲哀的现实
悲哀的现实 2020-11-21 04:18

What is the best way to represent a Windows directory, for example \"C:\\meshes\\as\"? I have been trying to modify a script but it never works because I can\'t

5条回答
  •  误落风尘
    2020-11-21 04:59

    In case you'd like to paste windows path from other source (say, File Explorer) - you can do so via input() call in python console:

    >>> input()
    D:\EP\stuff\1111\this_is_a_long_path\you_dont_want\to_type\or_edit_by_hand
    'D:\\EP\\stuff\\1111\\this_is_a_long_path\\you_dont_want\\to_type\\or_edit_by_hand'
    

    Then just copy the result

提交回复
热议问题