python路径相关小问题

1.getcwd无法再windows server上执行

使用os.path.dirname(__file__)获取当前文件目录

2.SyntaxError: EOL while scanning string literal

windows路径‘\’转义问题,使用r转义最后一个字符不能是‘\’;

dataPath =r "D:\exportMould\filePath/file\"错误,改成dataPath =r "D:\exportMould\filePath/file"+'\\'

3.python打开windows共享文件夹文件

dataPath =r "D:\exportMould\filePath/file"+'\\'

猜你喜欢

转载自www.cnblogs.com/shinesea/p/9882426.html