python
thyme_C
这个作者很懒,什么都没留下…
展开
-
PEP8 整理
Introduction 介绍官方原文: Python PEP8本文提供的Python代码编码规范基于Python主要发行版本的标准库。许多项目有自己的编码规范,在出现规范冲突时,项目自身的规范优先。A Foolish Consistency is the Hobgoblin of Little Minds 呆板的坚持一致性是傻的没边了“Readability counts” 可读性很重要A style guide is about consistency. Consistency with t原创 2020-06-03 01:05:48 · 253 阅读 · 0 评论 -
python实现 Lsystem quadratic Koch island
Lsystem: http://www.sidefx.com/docs/houdini/nodes/sop/lsystem.html本篇文章要实现如下图案代码如下:from turtle import *length = 10angle = 90def draw_path(path): for symbol in path: if sym...原创 2020-01-30 13:19:44 · 260 阅读 · 0 评论 -
python turtle 画树
绘制过程: 画右子树 返回节点 画左子树 返回节点树图结果:from turtle import *def draw_tree(length): if length >= 5: # draw trunk of length forward(length) # turn right...原创 2020-01-30 12:45:40 · 1093 阅读 · 0 评论 -
python计算斐波那契数,不使用递归解决超时问题
使用递归的方式求第50个斐波那契数就会超时,而选用如下不使用递归的方式,求第50个还是会很快使用递归def fbnq(n): if n == 1 or n == 2: return 1 return fbnq(n-1)+fbnq(n-2) n = int(input())print(fbnq(n))不使用递归:def fbnq(n)...原创 2019-01-06 22:34:44 · 823 阅读 · 0 评论 -
python查看文档的方法
https://blog.csdn.net/csdn_0_001/article/details/79550784想要了解一个模块,help(module)获取详细文档help(time)help(re)help(pandas)快速获取模块包含的方法dir(module.function) 或者 module.function.__doc__>>> hel...转载 2018-08-25 22:00:09 · 512 阅读 · 0 评论 -
python3爬取天才小毒妃
from bs4 import BeautifulSoupimport requestsdef get_url_list(url): headers = {"User-Agent":"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.6...原创 2018-08-29 23:04:34 · 227 阅读 · 0 评论 -
python基本数据结构: tuple,list, dict,set
利用help查看数据类型的方法并练习,练习过程注意参数的设置,请将这些常用方法牢记于心这三种类型是iterable类型的object,所以iterable可使用的方法他们也可以用tuple:>>> help(tuple)Help on class tuple in module builtins:class tuple(object) | tuple(it...原创 2018-08-24 13:33:19 · 271 阅读 · 0 评论 -
sort and sorted
>>> help(sorted)Help on built-in function sorted in module builtins:sorted(iterable, /, *, key=None, reverse=False) Return a new list containing all items from the iterable in ascendin...原创 2018-08-24 13:11:01 · 162 阅读 · 0 评论 -
python 多线程threading
推荐一个不错的python教程https://www.tutorialspoint.com/python/python_multithreading.htm这里的多线程写的很nice, 例子很容易懂我的例子如下:multiThreadingRun继承threading.Thread的class只需要override __init__和run方法,使用时,实例化multiThread...原创 2018-08-21 13:07:46 · 179 阅读 · 0 评论 -
10大经典排序算法Python实现(待完善)
算法说明参考如下:https://www.cnblogs.com/onepixel/articles/7674659.html冒泡排序:ll = [3,38,5,44,15,36,47,26,27,2,46,4,19,50,48]a = 1l2 = range(len(ll)-1)while a: a = 0 for i in l2: if...原创 2018-08-23 15:23:48 · 139 阅读 · 0 评论