随笔分类 -  python(新)

摘要:# 字典的创建# dict1 = {}# print(type(dict1))## dict2 = {# 'name':'汪峰',# 'sex':'男',# 'hiredate':'1997-10-20'# }# print(dict2)## dict3 = dict(name = 'eric',a 阅读全文
posted @ 2019-07-30 18:28 EricBlog 阅读(434) 评论(0) 推荐(0)
摘要:# 列表的创建# list = ['a','b','c','d','c','e','f','c']# print(list)## list1 = []# print(list1)## # 索引 取值# c = list[2]# print(c)# c = list[-4]# print(c)## # 阅读全文
posted @ 2019-07-30 16:58 EricBlog 阅读(189) 评论(0) 推荐(0)
摘要:# 赋值运算符# a = 1# b = 2# c = 3# d = 4# e = 5# f = 6## a += 1# print(a )# a -= 1# print(a )## c *= 1# print(c)# d //= 1# print(d)## e %= 4 #1# print(e)## 阅读全文
posted @ 2019-07-30 15:37 EricBlog 阅读(148) 评论(0) 推荐(0)
摘要:# 循环语句# while 循环'''i = 0;while i < 5: print('python is the best language') i += 1# 阶乘计算器i = 1result = 1while i <= 2: result = result * i if i % 5 == 0 阅读全文
posted @ 2019-07-30 14:33 EricBlog 阅读(205) 评论(0) 推荐(0)
摘要:# 分支语句age = 233if age < 18: print('您还未满18岁,禁止入内')elif age > 18 and age < 60: print("欢迎光临,年龄在18-60之间")else: print("欢迎光临,年龄大于60岁")weight = input('体重(kg) 阅读全文
posted @ 2019-07-30 13:28 EricBlog 阅读(399) 评论(0) 推荐(0)
摘要:# 字符串常用函数# 转大写print('bmw'.upper()) # BMW# 转小写print('BMW'.lower()) # bmw# 首字母大写print('how aae you ?'.capitalize()) # How aae you ?# 设置每个单次首字母大写print('m 阅读全文
posted @ 2019-07-30 10:55 EricBlog 阅读(884) 评论(0) 推荐(0)