Skip to content

Commit b8e439e

Browse files
committed
python-mysql
1 parent de77d69 commit b8e439e

5 files changed

Lines changed: 53 additions & 3 deletions

File tree

py_linux_jiankong/4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
if len(sys.argv) > 1:
66
INTERFACE = sys.argv[1]
77
else:
8-
INTERFACE = 'eth0'
8+
INTERFACE = 'wlan0'
99
STATS = []
1010
print 'Interface:',INTERFACE
1111

python_mysql/creat-mysql-biao.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#coding=utf-8
2+
import MySQLdb
3+
4+
conn= MySQLdb.connect(
5+
host='localhost',
6+
port = 3306,
7+
user='root',
8+
passwd='123456',
9+
db ='test',
10+
)
11+
cur = conn.cursor()
12+
13+
#创建数据表
14+
#cur.execute("create table student(id int ,name varchar(20),class varchar(30),age varchar(10))")
15+
16+
#插入一条数据
17+
#cur.execute("insert into student values('2','Tom','3 year 2 class','9')")
18+
19+
20+
#修改查询条件的数据
21+
#cur.execute("update student set class='3 year 1 class' where name = 'Tom'")
22+
23+
#删除查询条件的数据
24+
#cur.execute("delete from student where age='9'")
25+
26+
cur.close()
27+
conn.commit()
28+
conn.close()

python_pachong/.getjpg.py.swp

12 KB
Binary file not shown.

python_pachong/getjpg.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ def getimg(html):
1818
urllib.urlretrieve(imgurl,'%s.jpg' % x)
1919
x+=1
2020

21-
html = getHtml('http://tieba.baidu.com/p/4133040044')
22-
21+
html = getHtml('http://tieba.baidu.com/p/4412785952')
2322
print (getimg(html))

python_pachong/getjpg1.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#coding = utf-8
2+
import re
3+
import urllib
4+
5+
def getHtml(url):
6+
page = urllib.urlopen(url)
7+
html = page.read()
8+
return html
9+
10+
def getimg(html):
11+
reg = r"./jpg"
12+
print reg
13+
imgre = re.compile(reg)
14+
imglist = re.findall(imgre,html)
15+
print imglist
16+
x = 0
17+
for imgurl in imglist:
18+
urllib.urlretrieve(imgurl,'%s.jpg' % x)
19+
x+=1
20+
21+
html = getHtml('http://tieba.baidu.com/p/4133040044')
22+
23+
print (getimg(html))

0 commit comments

Comments
 (0)