Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

form list of filename get the filename with highest num pythn

import re
list_of_files = ["file1","file100","file4","file7"]

def extract_number(f):
    s = re.findall("d+$",f)
    return (int(s[0]) if s else -1,f)

print(max(list_of_files,key=extract_number))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #form #list #filename #filename #highest #num #pythn
ADD COMMENT
Topic
Name
9+2 =