#之前對變數加入問題,查到的解決方案
from pathlib import Path
nday = ’201201020.log’
#pathlib.Path()
palib = Path(‘c:’,'/’,'Users’, nday)
#print ( Path(‘c:’,'/’,'Users’) )
print ( palib )
#os.path()
import os
ospath = ( os.path.join(‘c:’, os.sep, ‘Users’, nday) )
print ( ospath )
或者是
flogfile = "D:\\Backup\\hsbat\\log\\" + nday + ‘.log’
print( flogfile )