tipstricks:tips_and_tricks
Ceci est une ancienne révision du document !
Table des matières
Python - Tips & Tricks
Include local files
import sys
sys.path.append('./lib')
from mycode import *
sys.path.append("/opt/kookel/kloud/bin")
import inventory_helper
from kloud_inventory import KloudInventory
Timestamp & delta T
timestruct_now_gmt = time.gmtime()time_now_gmt_text = time.strftime(“%Y%m%d-%H%M%S”, time.gmtime())timestruct_converted_from_exemple_string = time.strptime(“20171128-111321”, “%Y%m%d-%H%M%S”)epoch_t1 = time.mktime(timestruct_now_gmt)epoch_t2 = time.mktime(timestruct_converted_from_exemple_string)delta_seconds = epoch_t1 - epoch_t2print(delta_seconds)
tipstricks/tips_and_tricks.1533028913.txt.gz · Dernière modification : 2018/07/31 09:21 de ronan