上一页 1 ··· 4 5 6 7 8 9 10 下一页
摘要: s = set('hello,word') print(s) #set 方法 s = {'xiaoming', 'xiaoming', 'xiaoming1'} print(s) s.add('s') # 添加元素 s.clear(s) # 清空集合 s1 = s.copy(s) # 复制集合 s. 阅读全文
posted @ 2021-04-03 19:24 关于段主任的一切 阅读(58) 评论(0) 推荐(0) 编辑
摘要: ####################### 整理 ################# # 一、数字 # int(..) # 二、字符串 # replace/find/join/strip/startswith/split/upper/lower/format # tempalte = "i am 阅读全文
posted @ 2020-12-09 10:29 关于段主任的一切 阅读(75) 评论(0) 推荐(0) 编辑
摘要: # 字典 dict info0 = { 'a': '1', # 键值对 'b': '2' } info1 = { 'k1': 1, 'k2': True, 'k3': [ 11, 22, 33, { 'k11': 11, 'k22': 22, } ], 'k4': (1, 2, 3, 4,) } # 阅读全文
posted @ 2020-12-09 10:08 关于段主任的一切 阅读(210) 评论(0) 推荐(0) 编辑
摘要: # 列表 l = [1, 2, 3, 4, 5] # 元组 t = (1, 2, 3, 4, 5) # 列表可以修改删除和增加,元组不可被修改,不能被删除增加, tuple1 = (1, 'a', (2, 3), [4, 5], True, 6, '7',) # 一般写元组的时候在元组的最后的括号前 阅读全文
posted @ 2020-12-08 10:38 关于段主任的一切 阅读(162) 评论(0) 推荐(0) 编辑
摘要: ''' # list : 类 ,列表 list1 = [1, 2, 3, 'a', 'b'] # 通过list类创建的对象,li list1_1 = [1, 2, 3, ['c', 'd'], 'a', 'b'] # 列表嵌套列表 # 中括号括起来,中间','分隔每个元素.:可以使数字,字符串,列表 阅读全文
posted @ 2020-12-08 09:40 关于段主任的一切 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 1、执行 Python 脚本的两种方式 2、简述位、字节的关系 3、简述 ascii、unicode、utf-­‐8、gbk 的关系 4、请写出 “李杰” 分别用 utf-­‐8 和 gbk 编码所占的位数 5、Pyhton 单行注释和多行注释分别用什么? 6、声明变量注意事项有那些? 7、如有一下 阅读全文
posted @ 2020-11-13 16:27 关于段主任的一切 阅读(1221) 评论(0) 推荐(0) 编辑
摘要: # for循环 # for '变量名' in '字符串': # print('变量名') # 切片可以用, # 将文字对应的索引打印 # test = input('请输入:') # print(test) # l = len(test) # print(l) # print(' ') # r = 阅读全文
posted @ 2020-11-11 20:04 关于段主任的一切 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 实例001:数字组合 题目 有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少? 程序分析 遍历全部可能,把有重复的剃掉。 total=0 for i in range(1,5): for j in range(1,5): for k in range(1,5): if 阅读全文
posted @ 2020-11-06 20:34 关于段主任的一切 阅读(450) 评论(0) 推荐(2) 编辑
摘要: 数字: int int : 转换,将字符串转化成数字 num1 = '123' num2 = int (a) numadd = num2 +1000 print(num2) num3 = 'a' v = int (num3 , base = 16 ) # base==n ,base 表示进制,bas 阅读全文
posted @ 2020-11-06 20:12 关于段主任的一切 阅读(123) 评论(0) 推荐(0) 编辑
摘要: # encoding: utf-8 # module builtins # from (built-in) # by generator 1.147 """ Built-in functions, exceptions, and other objects. Noteworthy: None is 阅读全文
posted @ 2020-11-05 20:29 关于段主任的一切 阅读(204) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 下一页