分离路径、文件名

org_path = r"F:\temp\test"
fpath, fname = os.path.split(org_path)
print(fpath,fname)

# F:\temp  test

拼接路径

org_path = r"F:\temp\test"
for f in os.listdir(org_path):
    f_path = os.path.join(org_path,f)
    print(f_path)

# F:\temp\test\test1
# F:\temp\test\test2

 

相关文章:

  • 2021-12-30
  • 2021-10-11
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
猜你喜欢
  • 2022-01-10
  • 2021-04-25
  • 2021-12-18
  • 2022-12-23
  • 2021-12-10
  • 2021-07-25
  • 2021-11-17
相关资源
相似解决方案