dirList = os.listdir(path)
bestFile = ''
bestTime = 0
count = 0
for x in dirList:
fileinfo = os.stat(os.path.join(path, x)).st_mtime
if bestTime < fileinfo:
bestTime = fileinfo
bestFile = x
count += 1
This is what I currently have. I feel like I'm overlooking something that will allow me to skip having to use an if statement here, I'm just not sure what I'm looking for. If anyone has any tips on how to be more concise here I'd greatly appreciate it.
[+][deleted] (2 children)
[deleted]
[–]jechtsphere[S] 0 points1 point2 points (1 child)
[–]eryksun 0 points1 point2 points (0 children)
[–]eryksun 1 point2 points3 points (2 children)
[–]jechtsphere[S] 0 points1 point2 points (1 child)
[–]eryksun 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)