Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我应用此代码从 table 中获取 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