Python: ValueError: 2 is not in list -


I am starting a dragon and I stuck with this error. It would be of great help if you can tell me where I went wrong. This is my code:

  import math import nltk import json import pymongo #import sys import nlcs from dpcps imports from import_game import import_image import from importcs_nalysis Import from funcs import get_wordlist import get_pos_tag def Get_post (count): data = () Client = pimongo.mangoclonant ("localhost", 27017) # database Mongo DB = Enter data from customer. News_dataDataDataBase has been updatedNews_Updated db.News_Updated.find () temp = [] #print count if count == 0: data = db.ndtv elif count == 1: data = db.timesofindia elif count == 2: data = Db.hindustantimes elif count == 3: data = db.asianetnews elif count == 4: data = db.khabarndtv #print data.find () data. For posts in the fund): temp.append (post) return temporary If __name__ == '__main__': count = 0 limit = -1 while count & lt; 5: Data = gate_post (count) data = count for text in index (2) + = 1: print text  

However I get an output:

traceback (most recent call final): In data "main.py" for line, in line 43, Index (2): Value error: 2 is not in the list

Here is a sample of data from Mongoode.

{u'url ': u'62-year-old-woman-killed-in-tamil-nadu-s-salem-510469', U'_id ':' objectID '(' 53551ebf39b71c444a991341 '), Yudar': U "Salem, Tamilnadu: In a daring daylight, a 62-year-old woman killed two youths for a gold chain in a busy businessman. The police said in the area of ​​Salem in Tamil Nadu, Dandakshmi. He was behind his small shop on Arunachal Street, when in his absence the attackers snatched his throat from the knife to sleep Dune ops with Arunachalal road, jewelery, ships and cloth sha is considered as a busy commercial area of ​​the district, this incident sent waves of shock among the locals, Deputy Commissioner of Police AB Babu visited the spot. "}

Any help is greatly appreciated.

As mentioned, index () is a list of elements given Receives index. In your case, this 2 . You see that there is no element of error in your sequence ( data ) like 2 .

Perhaps you want to use data [2] ? This is not very clear from your question.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -