上一页 1 ··· 4 5 6 7 8 9 10 11 下一页
摘要: 例题2.11代码 import string import random x = string.ascii_letters + string.digits y = ' '.join([random.choice(x) for i in range(1000)]) d = dict() for ch 阅读全文
posted @ 2024-10-22 21:33 等我刷把宗师 阅读(30) 评论(0) 推荐(0)
摘要: 例题2.10代码 Dict = {'age': 18, 'score': [98, 97], 'name': 'zhang', 'sex': 'male'} for item in Dict: print(item) print(" ") for item in Dict.items(): prin 阅读全文
posted @ 2024-10-22 21:30 等我刷把宗师 阅读(20) 评论(0) 推荐(0)
摘要: 例题2.9代码 Dict = {'age': 18, 'score': [98, 97], 'name': 'zhang', 'sex': 'male'} try: print(Dict['age']) print(Dict.get('age')) print(Dict.get('address', 阅读全文
posted @ 2024-10-22 21:29 等我刷把宗师 阅读(22) 评论(0) 推荐(0)
摘要: 例题2.8代码 dict1 = {'Alice': '123', 'Beth': '456', 'Cecil': 'abc'} print(dict1['Alice']) dict1['new'] = 'Hello' dict1['Alice'] = '1234' dict2 = {'abc': 1 阅读全文
posted @ 2024-10-22 21:27 等我刷把宗师 阅读(36) 评论(0) 推荐(0)
摘要: 例题2.7代码 student = {'Tom', 'Jim', 'Mary', 'Tom', 'Jack', 'Rose'} print(student) a = set('abcdabc') print(a) 阅读全文
posted @ 2024-10-22 21:26 等我刷把宗师 阅读(9) 评论(0) 推荐(0)
摘要: 例题2.6代码 T = ('abc', 12, 3.45, 'python', 2.789) print(T) print(T[-1]) print(T[1:3]) 阅读全文
posted @ 2024-10-22 19:11 等我刷把宗师 阅读(12) 评论(0) 推荐(0)
摘要: 例题2.5_2代码 from numpy.random import randint import numpy as np a = randint(10, 20, 16) ma = max(a) ind1 = [index for index, value in enumerate(a) if va 阅读全文
posted @ 2024-10-22 19:10 等我刷把宗师 阅读(18) 评论(0) 推荐(0)
摘要: 例题2.5_1代码 import os fn = [filename for filename in os.listdir('F:\PYTHONwork\SpyderPython') if filename.endswith((',exe', '.py'))] print(fn) 阅读全文
posted @ 2024-10-22 19:09 等我刷把宗师 阅读(21) 评论(0) 推荐(0)
摘要: 例题2.4代码 a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] d = [c for b in a for c in b] print(d) 阅读全文
posted @ 2024-10-22 19:06 等我刷把宗师 阅读(21) 评论(0) 推荐(0)
摘要: 例题2.3代码 L = ['abc', 12, 3.45, 'python', 2.789] print(L) print(L[0]) L[0] = 'a' L[1:3] = ['b', 'Hello'] print(L) L[2:4] = [] print(L) 阅读全文
posted @ 2024-10-22 19:06 等我刷把宗师 阅读(17) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 下一页