随笔分类 -  Python

摘要:from urllib import request from bs4 import BeautifulSoup as bs import re import time import string # 网址 url = 'http://www.tcmap.com.cn/list/car_list.h 阅读全文
posted @ 2020-07-01 11:20 Lin_pin 阅读(409) 评论(0) 推荐(0)
摘要:socket编程步骤 family 地址簇,用与socket()函数的第一个参数。主要有以下几个 sockettype socket类型,用与socket()函数的第二个参数,常用的有 服务端 客户端 阅读全文
posted @ 2018-05-08 23:15 Lin_pin 阅读(515) 评论(0) 推荐(0)
摘要:1 class Dog(object): 2 def __init__(self, name): 3 self.name = name 4 5 def eat(self, food): 6 print('%s is eating ... %s' % (self.name, food)) 7 8 de 阅读全文
posted @ 2018-05-08 23:03 Lin_pin 阅读(110) 评论(0) 推荐(0)
摘要:压缩,解压操作 import zipfile # 压缩 # z = zipfile.ZipFile('123.zip', 'w') # z.write('123') # z.write('789') # z.close() # 解压 z = zipfile.ZipFile('123.zip', 'r') z.extractall() z.close() 阅读全文
posted @ 2018-03-19 00:05 Lin_pin 阅读(147) 评论(0) 推荐(0)
摘要:PYTHON发送邮件 一,普通文本发送 二、带图片发送 三、附件发送 s 阅读全文
posted @ 2018-03-19 00:03 Lin_pin 阅读(242) 评论(0) 推荐(0)
摘要:数据存储,操作csv 阅读全文
posted @ 2018-03-18 23:57 Lin_pin 阅读(187) 评论(0) 推荐(0)
摘要:一,新增配置文件 import configparser config = configparser.ConfigParser() config["DEFAULT"] = {'Server': "45", 'Comp': "yes"} config['bitbuckket.org'] = {} co 阅读全文
posted @ 2018-03-18 23:54 Lin_pin 阅读(112) 评论(0) 推荐(0)
摘要:元组 元组与列表类似,不同在于元组是不能被修改,用小括号,列表用方括号。 创建元组 查询元组 元组其他操作 阅读全文
posted @ 2018-01-17 09:29 Lin_pin 阅读(333) 评论(0) 推荐(0)
摘要:Python 列表 序列是Python中最基本的数据结构。序列中的每个元素都分配一个数字 - 它的位置,或索引,第一个索引是0,第二个索引是1,依此类推 序列都可以进行的操作包括索引,切片,加,乘,检查成员 列表是最常用的Python数据类型,它可以作为一个方括号内的逗号分隔值出现。列表的数据项不需 阅读全文
posted @ 2018-01-16 10:12 Lin_pin 阅读(1109) 评论(0) 推荐(0)
摘要:strings 分别在 Python2、Python 3下 Python 2 将 strings 处理为原生的 bytes 类型,而不是 unicode, Python 3 所有的 strings 均是 unicode 类型。 msg = '您好' # encode 将strings编码成bytes 阅读全文
posted @ 2018-01-16 09:20 Lin_pin 阅读(248) 评论(0) 推荐(0)
摘要:条件语句 if else 循环语句 while for 循环之break continue break语句用来终止循环语句,即循环条件没有False条件或者序列还没被完全递归完,也会停止执行循环语句。 break语句用在while和for循环中。 continue 语句用来告诉Python跳过当前循 阅读全文
posted @ 2018-01-15 17:53 Lin_pin 阅读(154) 评论(0) 推荐(0)
摘要:数据类型 Numbers(数字) int -有符号整型 / long-长整型 / float-浮点型 / complex-复数 String(字符串) List(列表) [] Tuple(元组) () Dictionary(字典) {} 数据类型转换 数字:int(x),long(x),float( 阅读全文
posted @ 2018-01-15 17:50 Lin_pin 阅读(229) 评论(0) 推荐(0)