get timestamp every 2 seconds python code example Example: python print timestamp import datetime ts = datetime.datetime.now().timestamp()