Skip to content

Instantly share code, notes, and snippets.

@fra3il
Created March 9, 2015 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fra3il/b95860eeef796a71f467 to your computer and use it in GitHub Desktop.
Save fra3il/b95860eeef796a71f467 to your computer and use it in GitHub Desktop.
[Blog] INSERT INTO ? VALUE ?
#!/usr/bin/env python
#coding=utf8
import MySQLdb
conn = MySQLdb.connect(host='localhost', user='root', passwd='', db='test')
cu = conn.cursor()
text = "문자열"
print(text)
try:
cu.execute("INSERT INTO test_table (text_fields) VALUE (%s)", (text))
except MySQLdb.Error, e:
print e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment