2020年1月28日

摘要: import random print(random.random()) #0.1-1 print(random.randint(1,8)) #1-8 print(random.choice("helloworld")) #h e l l o w o r l d 打散字符串,随机输出一个。 prin 阅读全文
posted @ 2020-01-28 15:36 三道_python 阅读(3383) 评论(0) 推荐(0)
 
摘要: import time # print(time.time()) # time.sleep(3) # print(help(time)) # print(time.gmtime()) # 中国24个时区 北京+8 结构化时间time.struct_time(tm_year=2020, tm_mon= 阅读全文
posted @ 2020-01-28 15:34 三道_python 阅读(171) 评论(0) 推荐(0)

2020年1月24日

摘要: 第一个版本,没有用户选择选项,思考中! flag_wx = False flag_jd = False def denglu(flag ="jd"): if flag == "jd": user,passwd = "ask","123" elif flag == "wx": user, passwd 阅读全文
posted @ 2020-01-24 10:18 三道_python 阅读(871) 评论(0) 推荐(0)

2020年1月23日

摘要: import time def foo(): print("foo....") time.sleep(1) def bar(): print("bar>>>") time.sleep(2) def timea(x): starttime = time.time() x() overtime = ti 阅读全文
posted @ 2020-01-23 17:38 三道_python 阅读(289) 评论(0) 推荐(0)

2020年1月13日

摘要: f = open("city.txt","r",encoding="utf-8") china_city = eval(f.read()) f.close() print("操作说明:增加》z,删除》del,进入》直接输入名称,返回上层》b") def quits(): import os prin 阅读全文
posted @ 2020-01-13 22:43 三道_python 阅读(163) 评论(0) 推荐(0)

2020年1月10日

摘要: 分析:此题目考虑到了字典,元组等数据,用字典比较好实现一些。 难点一:可随时返回上一级 思考中 为了方便先做三个省,每个省2个市,每个市1个县 难点二:随时退出程序。 思考中。 china_city = { "河北":{ "石家庄":{ "栾城","正定" }, "衡水":{ "枣强","武邑" } 阅读全文
posted @ 2020-01-10 20:43 三道_python 阅读(246) 评论(0) 推荐(0)
 
摘要: # String的内置方法 # st='hello kitty {name} is {age}'## print(st.count('l')) # 统计元素个数# print(st.capitalize()) # 首字母大写# print(st.center(50,'#')) # 居中# print 阅读全文
posted @ 2020-01-10 08:33 三道_python 阅读(125) 评论(0) 推荐(0)

2020年1月6日

摘要: product_list = ["1.iphone6s 5800元","2.mac book 9000元","3.coffee 32元","4.python 80元","5.bicyle 1500元"] product_cart = [] def sales(code,price): if sala 阅读全文
posted @ 2020-01-06 08:05 三道_python 阅读(190) 评论(0) 推荐(0)

2020年1月4日

摘要: 数据类型 整数 字符串 列表,元组 查 索引(下标) ,都是从0开始 切片 .count 查某个元素的出现次数 .index 根据内容找其对应的位置 "haidilao ge" in a 增加 a.append() 追加 a.insert(index, "内容") a.extend 扩展 修改 a[ 阅读全文
posted @ 2020-01-04 09:06 三道_python 阅读(133) 评论(0) 推荐(0)

2019年12月29日

摘要: a = 1 b = 2 a,b = b,a print(a+b) 阅读全文
posted @ 2019-12-29 20:35 三道_python 阅读(993) 评论(0) 推荐(0)