Created
July 17, 2020 08:26
-
-
Save CHARITH1995/eee9e2e8267515eadc9d6628bd97ddc2 to your computer and use it in GitHub Desktop.
save on mySQL database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sql = "INSERT INTO `newsarticles` (`source`, `sid`, `time`, `title`, `body`) VALUES (%s, %s, %s, %s, %s);" # those names depends on your database. | |
try: | |
cur.execute(sql, ('adaderana',0, date, title, contents)) | |
db.commit() | |
except (MySQLdb.Error, MySQLdb.Warning) as e: | |
print ("SQL Error") | |
raise e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment