windows和linux路径斜杠不兼容问题

windows
>>> import os
>>> os.getcwd()
'C:\\Program Files (x86)\\python27'
>>> os.path.join(os.getcwd(),"hello")
'C:\\Program Files (x86)\\python27\\hello'
>>> os.path.join(os.getcwd(),"hello","hi")
'C:\\Program Files (x86)\\python27\\hello\\hi'

linux
>>> import os
>>> os.path.join(os.getcwd(),"infra",'CMake.txt')
'/home/dev/vlyu/infra/CMake.txt'

 

 

 

 

 

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案