随笔分类 - Python 练习
摘要:新建一个 current_time.html 文件, !cur_time! 用来替换 新建一个 server.py 文件
阅读全文
摘要:函数 routers 返回一个 urlpatterns 元组,里面包含了路径名和函数名;在 函数 application 中遍历 urlpatterns 元组,路径存在则返回函数名,不存在则返回 404
阅读全文
摘要:要求: 1、创建三个游戏人物,分别是: 苍井井,女,18,初始战斗力1000 东尼木木,男,20,初始战斗力1800 波多多,女,19,初始战斗力2500 2、游戏场景,分别: 草丛战斗,消耗200战斗力 自我修炼,增长100战斗力 多人游戏,消耗500战斗力
阅读全文
摘要:```
import re def format_string(s): # 对表达式进行格式化 s = s.replace(' ', '') s = s.replace("--", "+") s = s.replace("++", "+") s = s.replace("+-", "-") s = s.replace("*+", "...
阅读全文
摘要:使用 Pyhotn 的while try list dict 实现跟用户简单的交互,展示省份,城市,区县的三级菜单
阅读全文
摘要:优化了上一个购物车程序:http://www.cnblogs.com/klvchen/p/8577269.html 运行结果如下: 程序还有很多可以优化的地方,以后有空再琢磨~
阅读全文
摘要:salary = int(input("Please input your salary: ")) msg = ''' 1. iphone6s 5800 2. mac book 9000 3. coffee 32 4. python book 80 5. bicyle 1500 6. exit ''' cart = [] flag = True while flag: pri...
阅读全文
摘要:注意: exit()里面可以跟字符串 if 判断表达式可以跟 and ,or
阅读全文
摘要:注意: range(100) 表示 0 到 99 个数字
阅读全文
摘要:num = 1 while num <= 9: tmp = 1 while tmp <= num: print(tmp, "*", num, "=", tmp*num, end="\t") tmp += 1 print("") num += 1 测试结果: for i in range(1, 10)
阅读全文
摘要:正方向 测试结果: 反方向: 测试结果:
阅读全文
摘要:使用 # 号输出一个长方形,用户可以指定宽和高 测试结果:
阅读全文

浙公网安备 33010602011771号