error traceback, sorted out the names just stuck with subtracting
It tells me timestamp is needed so I enter it than says timestamp is not defined?
I have to get the timestamp from the file and I want it to do this for every timestamp that shows that the car is speeding?
Error:Traceback (most recent call last):
File "C:\Users\Aston Instone\Documents\College\IT BTEC\Unit 16\Assignment 2\Python Program\CurrentProgram.py", line 30, in <module>
dateTimeIn-dateTimeOut
TypeError: unsupported operand type(s) for -: 'function' and 'function'
>>>It tells me timestamp is needed so I enter it than says timestamp is not defined?
from datetime import datetime #Function to convert date from string to dateTime def dateTimeIn(timestamp): dateTimeIn = datetime.strptime(strTimeIn, "%d/%m/%Y %H:%M:%S") return dateTimeIn def dateTimeOut(timestamp): dateTimeOut = datetime.strptime(strTimeOut, "%d/%m/%Y %H:%M:%S") return dateTimeOut #Main Program myFileIn=open("CameraIn.txt","rt") myFileOutput=open("Output.txt","rt") for lineIn in myFileIn: lineIn=myFileIn.readline() theListIn=lineIn.split(",") regIn=theListIn[0] strTimeIn=theListIn[1] myFileOut=open("CameraOut.txt","rt") for lineOut in myFileOut: lineOut=myFileOut.readline() theListOut=lineOut.split(",") regOut=theListOut[0] strTimeOut=theListOut[1] if regIn==regOut: dateTimeIn(timestamp)-dateTimeOut(timestamp)
Error:Traceback (most recent call last):
File "C:\Users\Aston Instone\Documents\College\IT BTEC\Unit 16\Assignment 2\Python Program\CurrentProgram.py", line 30, in <module>
dateTimeIn(timestamp)-dateTimeOut(timestamp)
NameError: name 'timestamp' is not defined
>>>I have to get the timestamp from the file and I want it to do this for every timestamp that shows that the car is speeding?