Saved Bookmarks
| 1. |
Which method is used to connect a database? Give an example? |
|
Answer» Step 1: create a connection using connect () method and pass the name of the database File Connecting to a database in step 2 means passing the name of the database to be accessed. If the database already exists the connection will open the same. Otherwise, Python will open a new database file with the specified name. # connecting to the database connection = sqlite3.connect (“Academy.db”) |
|