![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
Master的救赎
这个作者很懒,什么都没留下…
展开
-
class类中__init__()函数及self参数解析
1、class类内容类属性:类中所涉及的变量类方法:类中的函数2、__init__()函数解析a.双下划线开头的函数为私有函数,不能在类的外部被调用或直接访问b.init() ,支持带参数的初始化,例如:def __init__(self,ai_settings,screen):c.init()函数的第一个参数必须为self(也可是别的名字),后续参数可自由指定3、函数的定义基本形式:def 函数...原创 2018-03-13 17:14:46 · 2398 阅读 · 0 评论 -
python抓取豆瓣top250电影信息,并将数据存储到mysql
刚学python网上找的练手项目,实现起来比较容易,希望对大家有帮助 需求分析: python爬取豆瓣电影信息 对数据进行清洗 将清洗好的数据存储到mysql 下面是实现代码 爬虫+数据清洗部分,数据清洗暂时简单的使用replace()函数,主要用于解析导演,演员等信息,最后的sql引用数据库连接函数执行拼接的sql import requests from bs4 import Be...原创 2018-08-16 14:28:17 · 1360 阅读 · 2 评论 -
Python 图片转字符画
网上找的python的练手项目,用50行代码完成图片转字符画,项目使用了pillow库、argparse库 以下是实现代码,已在linux环境跑过,可正常运行: from PIL import Image import argparse # 外部命令行传入参数处理 parser = argparse.ArgumentParser() parser.add_argument('file')...原创 2018-08-20 22:47:10 · 243 阅读 · 0 评论 -
LeetCode算法题:Two Sum--Python
题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. 给出一个整形数组,返回数组中两个值的索引,这两个值相加等于一个特殊的target You may assume that each input would have exac...原创 2018-11-29 16:40:19 · 169 阅读 · 0 评论