Matching a filename on python -
i have multiple files in a, of them named 'network.log', while others named network-wthz.log. last 4 characters after hyphen keeps changing. wildcard can give match both files? using following if statement:
if current_file == 'network.log' or current_file == 'network-*.log': curr_file_path = dir_path + str('/') + str(current_file)
above code works fine, looks network.log. doesn't find files pattern network-xxxx.log.
if current_file.startswith('network') , current_file.endswith('.log')
Comments
Post a Comment