python fork函数
摘要:输出效果如下: 父进程id:30181 30181 父进程30181,我创建的子进程30182 30182 我是子进程30182,父进程30181 说明: 要了解多进程,先来了解操作系统。在类linux操作系统上,操作系统提供一个fork()系统调用。这个函数和普通的函数不太一样。普通的函数调用一次
阅读全文
posted @
2018-02-25 22:41
hailuo
阅读(367)
推荐(0) 编辑
python 实现连接mysql并读一条数据写到csv一条数据
摘要:import MySQLdb as mdb import csv with open('my.csv', 'w+', newline='') as csv_file: writer = csv.writer(csv_file) #获取 mysql 的链接对象 con = mdb.connect('localhost', 'root', 'root', 'test'); ...
阅读全文
posted @
2018-02-24 16:17
hailuo
阅读(674)
推荐(0) 编辑
python 使用csv.reader和csv.writer读写文件并转换成dataframe格式
摘要:详解参照http://blog.csdn.net/u011284860/article/details/51031051
阅读全文
posted @
2018-02-24 12:44
hailuo
阅读(5952)
推荐(1) 编辑
python 下载图片
摘要:import requests from PIL import Image from io import BytesIO url = 'http://image2.buslive.cn/shp/upload/2017/11/29_00545678.jpeg' response = requests.get(url) image = Image.open(BytesIO(response.con...
阅读全文
posted @
2018-02-23 18:22
hailuo
阅读(241)
推荐(0) 编辑
readline的用法
摘要:with open(r'C:\Users\admin\pycdtest\wanyue\llduizhang_20180207\33_1517970821000304388_119061116',encoding='utf-8') as f: line = f.readline() #print(type(line)) while line: #对line进行操作 lin...
阅读全文
posted @
2018-02-22 15:51
hailuo
阅读(1953)
推荐(0) 编辑
join合并字符串时使用生成器表达式
摘要:data=['11','pp','aa'] ','.join(str(d) for d in data)
阅读全文
posted @
2018-02-22 09:25
hailuo
阅读(433)
推荐(0) 编辑