我写的代码如下:

def createFileWithFileName(localPathParam,fileName):  
    totalPath=local_url+'\\'+fileName  
    if not os.path.exists(totalPath):
        print totalPath  
        file=open(totalPath,'w+')  
        file.close()  
        return totalPath  

起初时local_url使用的是绝对路径:F:程序名/imgs

但是了程序一直报No such file or dir的错,后来发现只要换为相对路径即可,

../imgs,程序运行成功

相关文章:

  • 2021-05-22
  • 2021-08-09
  • 2021-10-31
  • 2022-12-23
  • 2021-12-21
  • 2021-08-03
  • 2021-07-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案