上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 38 下一页
摘要: 运用css选择器:# -*- coding: utf-8 -*-from lxml import htmlpage_html = ''''''page_tree = html.fromstring(page_html.decode('utf-8'))ele ... 阅读全文
posted @ 2018-12-28 09:05 xuejianbest 阅读(1291) 评论(0) 推荐(0) 编辑
摘要: 向指定url发送get请求:# -*- coding: utf-8 -*-import urllib2url = "http://localhost:80/webtest/test?name=xuejianbest"req = urllib2.Request... 阅读全文
posted @ 2018-12-28 09:04 xuejianbest 阅读(4666) 评论(0) 推荐(0) 编辑
摘要: 原理:变量__EVENTVALIDATION和__VIEWSTATE表示现在页面的状态,其值一般存储在当前页面上。变量__EVENTTARGET会被作为第一个参数传入js方法__doPostBack(eventTarget, eventArgument),表... 阅读全文
posted @ 2018-12-28 09:04 xuejianbest 阅读(2463) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*-import urllibimport urllib2import redef getDetailUrl(name): reg = r'(.*?)' pattern = re.compile(reg,... 阅读全文
posted @ 2018-12-27 09:00 xuejianbest 阅读(547) 评论(0) 推荐(0) 编辑
摘要: import threading, timedef thread_go(s): print(s) time.sleep(2)start_time = time.time()ths = []for i in range(3): t = thr... 阅读全文
posted @ 2018-12-27 09:00 xuejianbest 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 锁定代码块:threadLock = threading.Lock()threadLock.acquire()# somecode...threadLock.release()阻塞直到线程结束:thread1 = myThread(1, "Thread-1"... 阅读全文
posted @ 2018-12-27 09:00 xuejianbest 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #coding=utf-8import threadingimport timeclass MyThread(threading.Thread): def __init__(self, name, delay): threading.Th... 阅读全文
posted @ 2018-12-27 09:00 xuejianbest 阅读(127) 评论(0) 推荐(0) 编辑
摘要: test.py内容:#!/usr/bin/env python#coding=utf-8from math import sqrtimport math as mthfor n in range (10, 0, -2): print n,else: ... 阅读全文
posted @ 2018-12-27 09:00 xuejianbest 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 获取命令行参数用sys.argv,参数类型都是str:t.py内容:#!/usr/bin/env python3#coding=utf-8import sysif __name__ == "__main__": print(len(sys.argv))... 阅读全文
posted @ 2018-12-27 09:00 xuejianbest 阅读(1544) 评论(0) 推荐(0) 编辑
摘要: 将一个文件夹内所有txt文件合并成一个txt文件。合并后的txt文件按章节对应原来每个txt文件,一个输入文件是一章,章节名字就是原txt文件文件名。import osdirPath = "dirpath" #所有txt位于的文件夹路径files = os.... 阅读全文
posted @ 2018-12-27 08:59 xuejianbest 阅读(4431) 评论(0) 推荐(0) 编辑
上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 38 下一页