The functions implemented with modules operation of the database
"" " 1. Import module pymysql 2. establish a connection object pymysql.connect () 3. Create a cursor object 4. Use the cursor object to execute SQL statements 5. acquired execution result 6. printout acquires the content 7. Close the cursor object 8. Close connection objects "" " Import pymysql # obtain parameters which host connection object: host number user: username password: password database: database name Conn pymysql.connect = (host = " localhost " , user = " the root " , password = " ***** " , database = " Test " ) CUR = conn.cursor () # for conveying the SQL statement to the database operations # Print (Result); = cur.execute Result ( " SELECT * from Vedio " ) # Returns the row number of affected Print ( " query to:% s of data " % Result) FETCH = cur.fetchone () # fetchonep (): returns a result of execution fetchall (): returns all of the results Print (FETCH) cur.close () conn.Close ()