2024-09-30 12:35:23 发布
网友
我用这个代码从表中取出id
getItemid=cursor.execute("Select id from shop_carthistory where order_id =%s",[order.order_number]) row=cursor.fetchall() context = {order_id": row } {{order_id}} gives => ((37L,),)
我只需要37个
您有一个包含一个元素的元组,它是一个包含一个元素的元组:
In [35]: a = ((37,),) In [36]: a Out[36]: ((37,),) In [37]: a[0] Out[37]: (37,) In [38]: a[0][0] Out[38]: 37
您有一个包含一个元素的元组,它是一个包含一个元素的元组:
相关问题 更多 >
编程相关推荐