集合
# 集合
'''
集合是無序不重複的
'''
# 建立清單
l = list((1, 1, 1))
l1 = [1, 1, 1]
print(l)
print(l1)
print("**************")
# 建立集合
s = set('wjw')
print(s, type(s))
print("-----------------")
print(set("wjw"))
print("++++++++++++++++++")
print(set("wjwqwert") or set("wqeqmn"))
print(set("wjwqwert") and set("wqeqmn123"))
深淺拷貝
# 深淺拷貝
s = [1, 2, 3, 4, 5, 6]
s2 = s.copy() # 将s拷貝給s2 s2與s獨立,互相不幹涉
print(s)
print(s2)
print("//////////////////////////")
s2[0] = 10
print(s)
print(s2)
print("***************************")
# 修改清單會互相影響
s4 = [[1, 2, 3], "wjw", "18"]
s3 = s4.copy()
s3[0][2] = 5
print(s3)
print(s4)
print("-------------------------------")
函數
def logger(log_text):
print("這是一個log函數 %s" % log_text)
logger("張三")
s='''
參數:
1. 必備參數
2. 關鍵字參數
3. 預設參數
4. 不定長參數
'''
print(s)
【版權聲明】本博文著作權歸作者所有,任何形式的轉載都請聯系作者擷取授權并注明出處!