How can I add a date to a literal file path in Python

I’d say it’s an error in your date format, though use of forward slashes is more ‘pythonic’.

timestamp = system.date.format(system.date.now(), 'YYYY-MM-dd_HH_mm_ss')

filepath = 'C:/myExports/{}.csv'.format(timestamp)

print filepath
>>> 
C:/myExports/2022-02-10_14_09_28.csv
>>> 
1 Like