在研發閑暇時間,將內容過程較好的一些內容做個記錄,如下的內容段是關於python判斷數組是否包含指定的元素的方法的內容,應該對大伙有用處。
print 3 in [1, 2, 3] # membership (1 means true
inventory = ["sword", "armor", "shield", "healing potion"]
if "healing potion" in inventory:
print "You will live to fight another day."