hey guys,
i am looking for a way to list a directory files/folders and find/match a string i define.
mystring = "cool_python_te st"
list = os.listdir( /adam/test/)
matches = re.match( mysting + "*", list)
the directory could contain:
cool_python_tes t_01
cool_python_tes t_02
test
cheese
i want the script to return the:
cool_python_tes t_01
cool_python_tes t_02
any ideas? I googled around and read something about using the re module - can't seem to get my head around it
any help would be awesome
cheers!
Adam
i am looking for a way to list a directory files/folders and find/match a string i define.
mystring = "cool_python_te st"
list = os.listdir( /adam/test/)
matches = re.match( mysting + "*", list)
the directory could contain:
cool_python_tes t_01
cool_python_tes t_02
test
cheese
i want the script to return the:
cool_python_tes t_01
cool_python_tes t_02
any ideas? I googled around and read something about using the re module - can't seem to get my head around it
any help would be awesome
cheers!
Adam
Comment