Python 字符串仅保留数字

2020-12-14  本文已影响0人  Rinaloving
num = re.sub("\D", "", num)
print(num)
数据库插入数据(时间函数)
def fun_Insert_to_Siemensdb(pkcode,mrname,floorid,floorname):
   cursor = conn.cursor()
   dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")  
   sql = "INSERT INTO Tbxxx (sxxId,sName,sxx,nxx,tCreate) VALUES (%s,%s,%s,%s,%s)"
   val = (pkcode,mrname,floorid,floorname,dt)
   cursor.execute(sql, val)
   conn.commit()
上一篇 下一篇

猜你喜欢

热点阅读