0

I have a code:

import datetime
time = datetime.datetime.now().strftime('%Y-%m-%d_%H:%M:%S')


df.to_excel(f"test_{time}.xlsx", index = False)

I receive an error:

OSError: [Errno 22] Invalid argument: 'test_2022-02-09_10:47:35.xlsx'

I am trying to have the time stamp in the excel file name. How can I get this to work?

Abramo
  • 77
  • 7

0 Answers0