from datetime import datetime t = datetime.now().time() seconds = (t.hour * 60 + t.minute) * 60 + t.second