Windows path in Python
问题 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 seem to get the directory right, I assume because of the \'\\\' acting as escape character? 回答1: you can use always: 'C:/mydir' this works both in linux and windows. Other posibility is 'C:\\mydir' if you have problems with some names you can also try raw string literals: r'C:\mydir' however best practice is to use the os.path module