How to use glob.glob function with pre-define path?

╄→гoц情女王★ 提交于 2019-12-24 21:25:51

问题


I want to use my pre-define path in glob function like code:

import glob
import os
list_of_files = glob.glob('/Jaymin/MAC Report/*.txt')
latest_file= max(list_of_files, key=os.path.getctime)

but instead of this I have path stored in my variable like:

My_path=/Jaymin/MAC Report

so how can I replace my_path variable to the path ? like:

list_of_files = glob.glob(MY_PATH'/*.txt')

来源:https://stackoverflow.com/questions/49644352/how-to-use-glob-glob-function-with-pre-define-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!