Код: Выделить всё
df = pd.read_csv(r"C:\Users\ME\Documents\INVENTORY.csv")
for root, dirs, files in os.walk(r"S:\XXXXXXXXXXX"):
for file in files:
sfullpath = os.path.join(root, file)
print(sfullpath)
dftemp = df.query(rf"FullPath == '{sfullpath}'") # Error here
if len(dftemp.index) == 0:
try:
ssize = str(os.stat(sfullpath).st_size)
ctime = os.stat(sfullpath).st_ctime
cdate = datetime.fromtimestamp(ctime).strftime('%m/%d/%Y')
atime = os.stat(sfullpath).st_atime
adate = datetime.fromtimestamp(atime).strftime('%m/%d/%Y')
with open(r"C:\Users\ME\Documents\INVENTORY.csv", 'a') as f:
f.write("%s,%s,%s,%s,%s,%s\n"%(sfullpath,file,root,ssize,cdate,adate))
except FileNotFoundError:
continue
Код: Выделить всё
File "", line 1
FullPath =='S:\XXXXXXXXXXX\XXXXXX\Nxxxxxxxxx\desktop.ini'
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 21-22: malformed \N character escape
Подробнее здесь: https://stackoverflow.com/questions/790 ... ndows-path
Мобильная версия