-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.log
More file actions
40 lines (32 loc) · 1.07 KB
/
python.log
File metadata and controls
40 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
=========读取excel=================
import xlrd #import module
workbook = xlrd.open_workbook(filename)
sheet = workbook.sheet_by_index(0)
sheet.cell_value(rownu,colnu)
sheet.row(nu)
print "Get a slice of values in column 3, from rows 1-3:"
print sheet.col_values(3, start_rowx=1, end_rowx=4)
-------------sheet.cell().ctype-----------
ctype : 0 empty,1 string, 2 number, 3 date, 4 boolean, 5 error
-----------------end---------------------
data_time = xlrd.xldate_as_tuple(sheet.cell(1,0),0) #格式化日期
===============for====================
for i, j in enumerate(sequence):
=======xpath==========
安装: pip install lxml
from lxml import etree
//exp1
info = etree.parse('a.xml')
tree = info.getroot()
tree2 = etree.tostring(info,pretty_print=True)
book = tree.findall('book')
for i in book:
print i.find('title').text
//exp2
tree.find("./book[@category='WEB']")
======beautiful soup===========
pip install beautifulsoup4
pip install lxml
pip install html5lib
==========request==============
http://docs.python-requests.org/zh_CN/latest/user/quickstart.html