上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 67 下一页
摘要: 读取CSV(逗号分割)文件到DataFrame 也支持文件的部分导入和选择迭代 更多帮助参见:http://pandas.pydata.org/pandas docs/stable/io.html 参数: filepath_or_buffer: str,pathlib。str, pathlib.Pa 阅读全文
posted @ 2019-05-17 10:52 hank-li 阅读(227) 评论(0) 推荐(0)
摘要: 在Python中,可以方便地使用os模块来运行其他脚本或者程序,这样就可以在脚本中直接使用其他脚本或程序提供的功能,而不必再次编写实现该功能的代码。为了更好地控制运行的进程,可以使用win32process模块中的函数,如果想进一步控制进程,则可以使用ctype模块,直接调用kernel32.dll 阅读全文
posted @ 2019-05-09 13:27 hank-li 阅读(18929) 评论(0) 推荐(2)
摘要: 因为json数据不规范出现了以下问题: 网上查到可以使用demjson来处理 安装 demjson的介绍 快速说明: http://deron.meranda.us/python/demjson/ demjson有两个主要的方法: encode 编码,将对象转换为json decode 解码,将js 阅读全文
posted @ 2019-05-07 18:19 hank-li 阅读(3582) 评论(0) 推荐(0)
摘要: 方法1:采用sys.exit(0)正常终止程序,从图中可以看到,程序终止后shell运行不受影响。 方法2:采用os._exit(0)关闭整个shell,从图中看到,调用sys._exit(0)后整个shell都重启了(RESTART Shell)。 方法3:采用Ctrl+C快捷键,强制终止程序执行 阅读全文
posted @ 2019-05-07 15:12 hank-li 阅读(52077) 评论(0) 推荐(0)
摘要: ``` 用asyncio和aiohttp抓取博客的总阅读量 (提示:先用接又找到每篇文章的链接) https://www.jianshu.com/u/130f76596b02 import re import asyncio import aiohttp import requests import 阅读全文
posted @ 2019-05-06 17:13 hank-li 阅读(177) 评论(0) 推荐(0)
摘要: ``` coding:utf 8 import re import ssl import csv import json import time import random import asyncio import aiohttp import requests from lxml import 阅读全文
posted @ 2019-05-06 17:10 hank-li 阅读(212) 评论(0) 推荐(0)
摘要: ``` coding:utf 8 import asyncio 通过create_task()方法 async def a(t): print(' ', t) await asyncio.sleep(0.5) print(' 阅读全文
posted @ 2019-05-06 17:08 hank-li 阅读(102) 评论(0) 推荐(0)
摘要: ``` coding:utf 8 通过gather方法 import asyncio async def a(t): print(' ', t) await asyncio.sleep(0.5) print(' 阅读全文
posted @ 2019-05-06 17:06 hank-li 阅读(89) 评论(0) 推荐(0)
摘要: ``` import aiohttp import asyncio import ssl async def fetch(session, url): async with session.get(url,ssl=ssl.SSLContext()) as response: return await response.text() async def main(): ... 阅读全文
posted @ 2019-05-06 16:50 hank-li 阅读(118) 评论(0) 推荐(0)
摘要: ``` # 多线程 import threading import time class myThread(threading.Thread): def __init__(self, threadID, name, counter): threading.Thread.__init__(self) self.threadID = threadID ... 阅读全文
posted @ 2019-05-06 16:28 hank-li 阅读(102) 评论(0) 推荐(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 67 下一页