arr = ['a','b','c'] arr.append('d') print(arr) for each in arr: print(each)
# 原文: #http://c.biancheng.net/view/2209.html #https://blog.csdn.net/qq_19741181/article/details/79827963 # python的区间是前闭后开,索引还是从0开始 lang = ["Python", "C++", "Java", "PHP", "Ruby", "MATLAB"] arr=lang[1:4:1] print(arr) del lang[1: 4] print(lang)
import numpy as np arr=[] arr.append((0, 1)) # 元素不在数组中 if (0,11) not in arr: print(111) # 元素在数组中 if (0,1) in arr: print(222) print(arr)