Wednesday 15 July 2015

mysql - Python 2.7 error with %s -


I tried all possible suggestions and no results. This is my code

  Class Tweet Raw_tweet and 'delete' is not in raw_tweet: itself ['user_id'] = raw_tweet ['user'] ['id'] ('id'] [[Screen_name]] = 'raw_tweet [' user ' ] ['Screen_name'] itself ['timestamp'] = datetime persers. Prs (raw_tivate [u'erited_at ']) .institute (tzinfo = none) .isoformat (own [' hetteg '] = [x [' text ' ] Raw_tweet for x ['entities'] ['hashtags']] own ['tax'] ['Id'] = raw_tweet ['id'] = 'raw_tweet [' text '] itself [' geo '] =' raw_tweet ['geo'] ['coordinate'] if raw_tweet ['geo'] and none [ ] If REALTIME_DATA: T = None T: T = Tweet (stream.next ()) Other: T = tweets (json.load (open ('one_tweet.json')) print json.dumps (t, sort_keys = true) , Indent = 2) Userid = T.values ​​() [0] scranna = T.values ​​() [1] timestamp = T. value ([2] hashtag = T. value () [3] text = T. Values ​​() [4] Geo = T.values ​​() [5] id = T.values ​​() [6] data = (2) c.execute ("in tweets (user_id) values "(% S)", (userid)) cnx.commit ()  

stack overflow Tried all the suggested changes on the Python Docks, MySQL docs ... to know that it has already been spent for 6 hours .. I still get this error ..

  traceback (most recent call final): The file "c: \ user \ lizard \ workspace \ last_project \ main.py", line 69,  

What's going on? What's going on? Manual which is not happy with your 'why' for the correct syntax for your simulator. Please help and do not have any type of reply please "Please try ... you have read ... because I I was sure that this is a simple thing. I just do not have it anywhere "

Adding a comma will have to pass a Tupal:

  c .execute ("enter the tweets (user_id) values" (% s) ", (userid,))  
From

:

A special problem is the creation of tuples in which there are 0 or 1 items: There are some additional quirks to adjust them in syntax: Blank Tupe is constructed by an empty pair of brackets; The formation of a tupal with an item is done on the basis of a value with a comma (this is not enough to attach a value to the bracket) . Ugly, but effective


No comments:

Post a Comment