[New help] Pymysql why does the linked database report EOF errors?

Source: Internet
Author: User
1. Using the Pymysql link database times error
Error code:

SyntaxError: unexpected EOF while parsingProcess finished with exit code 1

2. Here's My Code

import pymysql## 链接数据库connection = pymysql.connect(host = 'localhost',user = 'root',passwd = 'gangan',db = 'qiandao')try:    cur = connection.cursor()    cur.execute("SELECT fk_si_user,si_trueName from fbl_stuinfo where si_trueName like '甘%'")    data = cur.fetchall()    for row in data:       print('%s\n%s'%row)        cur.close()    connection.commit()    

What does 3.EOF error mean, and what is the general solution? Python 3.5 Newcomers

Reply content:

1. Using the Pymysql link database times error
Error code:

SyntaxError: unexpected EOF while parsingProcess finished with exit code 1

2. Here's My Code

import pymysql## 链接数据库connection = pymysql.connect(host = 'localhost',user = 'root',passwd = 'gangan',db = 'qiandao')try:    cur = connection.cursor()    cur.execute("SELECT fk_si_user,si_trueName from fbl_stuinfo where si_trueName like '甘%'")    data = cur.fetchall()    for row in data:       print('%s\n%s'%row)        cur.close()    connection.commit()    

What does 3.EOF error mean, and what is the general solution? Python 3.5 Newcomers

You should put all the errors on the report, it is not necessarily because even MySQL, the most likely is your print problem

Print (r'%sn%s '%row) put a r in front of the test

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.