Python Forum
Creating a program that records speed in a speed trap
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a program that records speed in a speed trap
#1
That is my code so far it says my subtraction is wrong can you point out anything I can do better.

Thanks.

from datetime import datetime
#Function to convert date from string to dateTime
def dateTimeIn(timestamp):
    dateTimeIn = datetime.strptime(strDateIn, "%d/%m/%Y %H:%M%S")
    return dateTimeIn
def dateTimeOut(timestamp):
    dateTimeOut = datetime.strptime(strDateOut, "%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-dateTimeOut
Reply


Messages In This Thread
Creating a program that records speed in a speed trap - by astonavfc - Nov-01-2016, 05:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  speed up getting embedding from bert model for large set of text veda 7 335 May-27-2024, 08:28 AM
Last Post: Pedroski55
  Suggestion on how to speed up this code? sawtooth500 1 309 May-04-2024, 07:13 PM
Last Post: sawtooth500
  Concurrent futures threading running at same speed as non-threading billykid999 13 2,110 May-03-2023, 08:22 AM
Last Post: billykid999
  itertools and amazing speed Pedroski55 8 2,204 Nov-11-2022, 01:20 PM
Last Post: Gribouillis
  How to speed up nested cycles? alexfrol86 3 1,657 Mar-25-2022, 06:19 AM
Last Post: deanhystad
  How to know coming snmp trap version in python pysnmp? ilknurg 0 2,683 Jan-31-2022, 12:16 PM
Last Post: ilknurg
  Increase the speed of a python loop over a pandas dataframe mcva 0 1,385 Jan-21-2022, 06:24 PM
Last Post: mcva
  Speed up code with second process help samuelbachorik 0 1,462 Sep-04-2021, 09:31 AM
Last Post: samuelbachorik
  Random coordinate generator speed improvement saidc 0 2,102 Aug-01-2021, 11:09 PM
Last Post: saidc
  creating simplex tableau pivot program easy or difficult for a beginner in Python? alex_0 2 2,676 Mar-31-2021, 03:39 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020