123456789101112131415161718192021222324252627282930313233343536 |
- #!/usr/bin/env python
- # -*- coding: UTF-8 -*-
- import os
- import pymysql.cursors
- import sys
- print ("222222", sys.argv[1])
- # 连接数据库
- connect = pymysql.Connect(
- host='192.168.1.50',
- port=3326,
- user='root',
- passwd='root',
- db='zp30o1_db',
- charset='utf8'
- )
- cursor = connect.cursor()
- sql = "select * from user"
- cursor.execute(sql)
- for row in cursor.fetchall():
- print(row[2])
- print('共查找出', cursor.rowcount, '条数据')
- # main
- def main():
- print ("hello world!")
- # start
- if __name__ == "__main__":
- main()
|