Python基础
IO及数据库交互
IO:
open(name[, mode[, buffering]])
with open(name[, mode[, buffering]]) as file_2:
数据库:
connect = pymysql.connect(host = \'127.0.0.1\',
port=3306,
user = \'root\',
password= \'\',
database = \'\',
charset = \'utf8\')
建立游标
py_cursor =connect.cursor()
执行SQL
import pandas as pd
py_cursor.execute(\"\"\"
show databases;
\"\"\")
pd.DataFrame(py_cursor)


雷达卡


京公网安备 11010802022788号







