随笔分类 -  #Learn-All

摘要:# 函数 def functions(x): """ functions test """ x += 1 y = x ** 2 return x, y functions = functions(x=5) # print(functions) """ def: 定义函数的关键字 function: 阅读全文
posted @ 2021-04-06 09:37 关于段主任的一切 阅读(184) 评论(0) 推荐(0)
摘要:字符串 数字 列表 元组 字典 分类: 可变不可变, 用id查看 1可变: 列表,字典 2不可变: 字符串,数字,元组 访问顺序 1顺序访问: 字符串,列表,元组 2直接访问: 数字 3映射: 字典 存放元素个数 1容器类型: 列表,元组,字典 2原子: 数字,字符串 集合 不同元素 无序 不可变类 阅读全文
posted @ 2021-04-05 11:09 关于段主任的一切 阅读(57) 评论(0) 推荐(0)
摘要:# %s 全能 print('I am %s my hobby is %s' %('A','alex')) print('I am %s , I`m %s year old' %('A',1)) # %d 整型 # name = input('你的姓名:') # age = int(input('你 阅读全文
posted @ 2021-04-03 19:25 关于段主任的一切 阅读(49) 评论(0) 推荐(0)
摘要: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 关于段主任的一切 阅读(84) 评论(0) 推荐(0)
摘要:####################### 整理 ################# # 一、数字 # int(..) # 二、字符串 # replace/find/join/strip/startswith/split/upper/lower/format # tempalte = "i am 阅读全文
posted @ 2020-12-09 10:29 关于段主任的一切 阅读(85) 评论(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 关于段主任的一切 阅读(221) 评论(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 关于段主任的一切 阅读(178) 评论(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 关于段主任的一切 阅读(259) 评论(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 关于段主任的一切 阅读(1259) 评论(0) 推荐(0)
摘要:# for循环 # for '变量名' in '字符串': # print('变量名') # 切片可以用, # 将文字对应的索引打印 # test = input('请输入:') # print(test) # l = len(test) # print(l) # print(' ') # r = 阅读全文
posted @ 2020-11-11 20:04 关于段主任的一切 阅读(99) 评论(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 关于段主任的一切 阅读(495) 评论(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 关于段主任的一切 阅读(130) 评论(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 关于段主任的一切 阅读(228) 评论(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:28 关于段主任的一切 阅读(186) 评论(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:27 关于段主任的一切 阅读(183) 评论(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:26 关于段主任的一切 阅读(330) 评论(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:25 关于段主任的一切 阅读(158) 评论(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:11 关于段主任的一切 阅读(173) 评论(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:05 关于段主任的一切 阅读(207) 评论(0) 推荐(0)
摘要:##运算符 算数运算符: > 赋值运算符 >>>返回结果为值 + # 加 - # 减 * # 乘 / # 除以 ** # 幂运算 % # 取余数 // # 取商 #################### 赋值运算符: > 算数运算符 >>>返回结果为值 a = a + b == a += b a = 阅读全文
posted @ 2020-11-04 23:32 关于段主任的一切 阅读(128) 评论(0) 推荐(0)