If you don't want to be old enough to find old code that you've written before, it's exhausting and labor, and it's easy to get bored. So the summary is put on this side of the good.
Parse string into time object and calculate the interval (in seconds)
# Calculates the difference of two timestamps import timefrom datetime import datetimefmt = "%y-%m-%dt%h:%m:%s.%fz" #2016 -02-18t12:22:22.123456ztime1_ obj = Datetime.strptime (time1, fmt) time2_obj = Datetime.strptime (time2, FMT) time_interval = Int (Time.mktime (time2_ Obj.timetuple ())-Time.mktime (Time1_obj.timetuple ()))
Call Shell command in Python script
# The combination of Python and Shell is useful in practical research import subprocesssubprocess.call (["LS", "-l"], cwd= ")
Read XML from File_path
Import Xml.etree.ElementTree as Ettree = Et.parse ("test.xml") root = Tree.getroot () # Apply DOM operations on root