python - get modificated dates of files in a path -


i path names input file. want return modification dates files in paths input file.however, error this:

traceback (most recent call last):   file "c:/users/ozann/desktop/odev334-2bdeneme.py", line 13, in <module>     print ("last modified: %s" % time.ctime(os.path.getmtime(e)))   file "c:\program files (x86)\python 3.5\lib\genericpath.py", line 55, in getmtime     return os.stat(filename).st_mtime oserror: [winerror 123] filename, directory name, or volume label syntax incorrect: 'c:\\users\\ozann\\workspace2\n' 

code:

import os, os.path, time, re  open("soru2btest.txt", "r") ins: array = [] line in ins:     array.append(line)  e in array:    m = re.match("^(.*/)?(?:$|(.+?)(?:(\.[^.]*$)|$))",e)    if m :       print(e)       print("true")       print ("last modified: %s" % time.ctime(os.path.getmtime(e))) 

the error you're getting because 'c:\\users\\ozann\\workspace2\n' illegal path in windows. while '\' separator, illegal character in file or directory name. can find information on illegal characters in windows here.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -