Which method is used to create a connection object between a Python script and…

2026

Which method is used to create a connection object between a Python script and a MySQL database assuming that the module pymysql is imported?

Answer: B. pymysql.connect()To create a connection object between a Python script and a MySQL database using the pymysql module, you must use the connect() function. The correct syntax…

  1. A.

    pymysql.open()

  2. B.

    pymysql.connect()

  3. C.

    pymysql.link()

  4. D.

    pymysql.join()

Attempted by 239 students.

Show answer & explanation

Correct answer: B

To create a connection object between a Python script and a MySQL database using the pymysql module, you must use the connect() function. The correct syntax is pymysql.connect(). Other methods such as open(), link(), or join() are not part of the pymysql API for establishing database connections.

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…