摘要: Python(4)--字典 字典 是一种Mapping的数据结构(如hashmap) def main(): # 不使用字典的情况下模拟映射 names = ['Tom','Alice','Eric'] numbers = ['2341','9102','3157'] # 找到Tom的电话 prin 阅读全文
posted @ 2020-08-09 18:49 Dave-Mo 阅读(70) 评论(0) 推荐(0)
摘要: Python(3)--字符串 字符串格式 字符串也是不可变的 # 元组匹配字符串格式 >>> format = "hello %s." >>> values('world') >>> values = ('world') >>> format % values 'hello world.' # 使用 阅读全文
posted @ 2020-08-09 08:23 Dave-Mo 阅读(48) 评论(0) 推荐(0)
摘要: python(2)--列表和元组 序列 >>> person1 = ['Tom',100] >>> person2 = ['Jerry',100] >>> datas = [person1,person2] >>> datas [['Tom', 100], ['Jerry', 100]] 索引 【0 阅读全文
posted @ 2020-08-09 08:22 Dave-Mo 阅读(35) 评论(0) 推荐(0)
摘要: Python基础(1) 基础语法 # 整除运算,向下取整 1 // 2 标识符:数字字母下划线。不能以数字开头 # 获取用户输入,返回字符串 c = int("c:") print(int(c)) # 幂运算 2 ** 3 pow(2,3) # 绝对值 abs(-3) # 取最接近整数,在两个整数一 阅读全文
posted @ 2020-08-09 08:21 Dave-Mo 阅读(29) 评论(0) 推荐(0)