The function below converts a time code into seconds, while maintaining the decimal value (fractions of seconds). The time code fed to this function will always contain microseconds. This currently works, but I'd be interested to see how it could be improved/simplified.  def Second_Conversion(x): #Takes a string such as 2:22:04.996304    HMS = x.split(':')    SF = x.split('.')    Full_HMS = x[0:7]    Split_HMS = Full_HMS.split(':')    Full_Units = int(Split_HMS[0]) * 3600 + int(Split_HMS[1]) * 60 + int(Split_HMS[2])    Second_Fractions = int(SF[1])    Converted_Seconds_Fractions = Second_Fractions /1000000    print(Converted_Seconds_Fractions)    Final_Time = Full_Units + Converted_Seconds_Fractions    print(Final_Time)
Time Code with Microsecond Conversion
python;datetime;python 3.x;converting
This section can be simplified as you only print the variables, never work with them:Second_Fractions = int(SF[1])Converted_Seconds_Fractions = Second_Fractions /1000000print(Converted_Seconds_Fractions)Final_Time = Full_Units + Converted_Seconds_Fractionsprint(Final_Time)Why don't you just do this?print(int(SF[1]) / 1000000)print(Full_Units + Converted_Seconds_Fractions)Also, it isn't good to have magic values in your code.  I would probably put the 1000000 value in a variable named with UPPER_CASE naming to show it shouldn't be changed.  Python does not have a way to signify constant variables, so that is why you use a different naming convention for them.Again, I would probably not print from the same method you convert them with.  What if you want to get the value from this method sometime without it printing them?  You should return the values instead of just printing them, and maybe make a separate method for printing them.