I have a function in python that is responsible for recognizing the date of a text file that reads, the date format to read is this for example: May 28 00:00
, I have changed the orders according to python but it gives me an error :
TypeError: not all arguments converted during string formatting
and the line of the error is as follows:
date_time="%s %s %s"%(self.year,file['month'],file['day'],file['time'])
registro['datetime'] = datetime.strptime(date_time, "%b %d %H:%M")
I will appreciate your help.
elif self.central in(410,411,401,402):
date_time="%s %s %s"%(self.year,file['month'],file['day'],file['time']) # <---
registro['datetime'] = datetime.strptime(date_time, "%b %d %H:%M") # <---
registro['filename']=file['filename']
registro['name_processed']=file['name']
registro['correlative']=int(file['id'])
registro['bytes']=int(file['bytes'].replace(",",""))
else:
date_time="%s %s %s %s"%(self.year,file['month'],file['day'],file['time'])
registro['datetime'] =datetime.strptime(date_time,"%Y %b %d %H:%M")
registro['filename']=file['filename']
registro['name_processed']=file['name']
registro['correlative']=int(file['id'])
registro['bytes']=int(file['bytes'].replace(",",""))
return registro