2019年3月4日

字典操作

摘要: #字典的操作d = {'name':'chuxu','age':90,'sex':'man'}#返回字典索引的键print(d.keys())#返回字典索引的值print(d.values())#把字典dict2的键/值对更新到dict里c = {}print(c.update(d))print(c 阅读全文

posted @ 2019-03-04 22:36 储旭 阅读(80) 评论(0) 推荐(0)

字符串函数

摘要: #字符串转换为小写print(s.lower())#字符串转换为大写print(s.upper())#字符串首字母转换为大写print(s.capitalize())#判断字符串首字母是否为Lprint(s.startswith('L'))#判断字符串结尾字母是否为Tprint(s.endswith 阅读全文

posted @ 2019-03-04 22:26 储旭 阅读(95) 评论(0) 推荐(0)

2019年3月1日

#9 9乘法表

摘要: #9 9乘法表for i in range(1,10): for j in range(1,i+1): print('%d * %d = %-3d' %(j,i,i * j),end='') print() 阅读全文

posted @ 2019-03-01 20:04 储旭 阅读(113) 评论(0) 推荐(0)

2019年2月26日

if、for、while语句

摘要: if else elif 语句实例:#定义一个变量age = 19#如果age小于等于18打印少年if age <= 18: print('少年')else:#如果age小于等于28打印青年 if age <= 28: print('青年')#如果age小于等于48打印青年 elif age <= 阅读全文

posted @ 2019-02-26 18:30 储旭 阅读(160) 评论(0) 推荐(0)

python的数据类型

摘要: 数据类型int 整数float 浮点数str 字符串bool 布尔类型 list 列表 tuple 元组dict 字典 set 集合 python运算符算数运算符 + - * / % 取余 【不能被整除的余数】 ** 幂运算 // 取整 关系运算符 > 大于 >= 大于等于 < 小于 <= 小于等于 阅读全文

posted @ 2019-02-26 11:22 储旭 阅读(87) 评论(0) 推荐(0)

导航