列表,鏈表,隊列
阿新 • • 發佈:2019-04-24
init 實現 lis rec strong med mes pri n)
# class Hero(object):
# def __init__ (self,no=None,name=None,nickname=None,pNext=None):
# self.on = no
# self.name = name
# self.nickname = nickname
# self.pNext = pNext
# def add(head,hero):
# head.pNext = hero
# def showAll(head):
# while head.pNext!=None:
# head =head.pNext
# print(head.name)
列表(數組):
數組需要一塊連續的內存空間來存儲,對內存的要求比較高。
補充:1個整型占4個字節,1個字節占8位,即1個整型占32位
舉例:
單鏈表的實現:
# class Hero(object):
# def __init__ (self,no=None,name=None,nickname=None,pNext=None):
# self.on = no
# self.name = name
# self.nickname = nickname
# self.pNext = pNext
# 這種方式只能在後面添加
# def add(head,hero):
# head.pNext = hero
# def showAll(head):
# while head.pNext!=None:
# head =head.pNext
# print(head.name)
-
-
在生產者端,設置
properties = pika.BasicProperties(
delivery_mode=2, # make message persistent
) -
在消費者端
auto_ack = False
ch.basic_ack(delivery_tag=method.delivery_tag)
列表,鏈表,隊列