forked from dcxy/learngit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f46cb9
commit 3b42cea
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#/usr/bin/python | ||
# -*- coding: UTF-8 -*- | ||
import pymysql | ||
# 创建连接 | ||
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='db', charset='utf8') | ||
#创建游标 | ||
cursor = conn.cursor() | ||
cursor.execute("select * from ww_link") | ||
|
||
# 获取剩余结果的第一行数据 | ||
# row_1 = cursor.fetchone() | ||
# print row_1 | ||
# 获取剩余结果前n行数据 | ||
# row_2 = cursor.fetchmany(3) | ||
|
||
# 获取剩余结果所有数据 | ||
row_3 = cursor.fetchall() | ||
print row_3 | ||
conn.commit() | ||
cursor.close() | ||
conn.close() | ||
|
||
|
||
|