
python编程快速上手
文章平均质量分 86
大奇哥哥
前端
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python编程快速上手——让繁琐工作自动化,第三章实践题答案。
Python编程快速上手——让繁琐工作自动化,第三章实践题答案(新手写的,望大家修改指正。)3.11.1 Collatz 序列def collatz(number):if number % 2 == 0: even = number // 2 print(even) return evenelif number % 2 == 1: uneven = 3*nu...原创 2018-12-25 15:14:38 · 677 阅读 · 0 评论 -
SyntaxError: can't assign to function call为什么会报错呢?
如何过滤以“0”开头的匹配,思路有,但是代码有问题,因为python中字符串是不可变的。import redef fun(num): numRegex = re.compile(r"^\d{1,3}(,\d{3})*$") mo = numRegex.search(num) "&am原创 2019-01-23 10:27:13 · 27063 阅读 · 0 评论 -
python编程快速上手之第6章实践项目答案。
python编程快速上手之第6章实践项目正确答案。看到网上好多答案都不对,反正我是没有找到一个正确答案,只找到一个最接近的,于是对他的代码进行优化。源代码和我优化过的代码都附上,供大家参考。这是源代码,有点问题,但思路值得借鉴。源代码链接:https://blog.youkuaiyun.com/do_care/article/details/79024539def tablePrint(tableDa...原创 2019-01-21 20:04:02 · 1051 阅读 · 3 评论 -
python编程快速上手 第9章实践项目答案
python编程快速上手 第9章实践项目答案9.8.1 选择性拷贝import os, shutilpath = "H:\\test1"new_path = "H:\\test2"for fold原创 2019-01-28 13:28:45 · 714 阅读 · 0 评论 -
Python编程快速上手-第8章实践项目答案
Python编程快速上手-第八章实践参考答案:import repath = "H:\\Users\\Administrator\\python3.7\\shijian8.9.2" #此文件路径必须存在(也可以自行创建或指定路径)textFile = open(path + &a原创 2019-01-26 12:49:20 · 917 阅读 · 2 评论 -
python中if,else问题
这是这两段代码是检测强弱密码的,要求至少8位字符且必须包含大小写字母和数字。第一段代码,没有用else语句,没有问题。import redef check(password): num = len(password) pwRegex_1 = re.compile(r'[A-Z]+') pwRegex_2 = re.compile(r'[a-z]+') pwRe...原创 2019-01-23 18:13:56 · 4545 阅读 · 5 评论 -
请教一个python问题,如何返回到指定的代码行?经小杰大牛指点,终于实现了。
如题,请看下面这段代码:print("Please give me two numbers.")print("I print out the sum of these two numbers")print("If you enter 'q' ,quit.")while True:原创 2019-01-02 09:06:41 · 27902 阅读 · 9 评论 -
python pygame中 .get_rect()得到的矩形有哪些rect属性
刚查了一下,Rect有以下属性,具体可以到pygame的文档上看:http://www.pygame.org/docs/ref/rect.htmlx,ytop, left, bottom, righttopleft, bottomleft, topright, bottomrightmidtop, midleft, midbottom, midrightcenter, centerx, ...原创 2019-01-05 12:05:38 · 19690 阅读 · 0 评论 -
简单的除法计算器-python实现
简单的除法计算器print("Please give me two numbers, and I'll divide them.")print("Enter 'q' to quit")while True: first_number = input("Please input t原创 2018-12-31 12:04:59 · 2848 阅读 · 0 评论 -
九九乘法表的4种写法----两个for循环
for k in range(1, 10): for v in range(1, k+1): print("{}*{}={}".format(v, k, v*k), end="\t") # print("%d*%d=%d" % (v, k, v*k), end=原创 2019-01-28 19:39:28 · 1360 阅读 · 0 评论