I am trying to read multiple file in my personal computer with glob.glob as below:
diri = r"C:\Users\Hoonill\Desktop\Python\BAO\2007\2011"
filin = diri + '\*10*datresult'
FileList=sorted(glob.glob(filin))
print(FileList)
my expected result was such as the series of
'C:\Users\Hoonill\Desktop\Python\BAO\2007\2011\BAO_100_2011229.datresult'
,
but what I got was the series of
'C:\\Users\\Hoonill\\Desktop\\Python\\BAO\\2007\\2011\\BAO_100_2011229.datresult'
I don't know why '\'
become '\\'
.
Based on other people's advice, this result seems due to addition of 'r' on file path, but without 'r', I got "SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape."
Any idea or help will be really appreciated.
Best regards,
Isaac