Linked Questions

Popular Questions

dictionary data extraction issue

Asked by At

top_100 is a mongodb collection:

the following code:

x=[]
thread=[]
for doc in top_100.find():
    x.append(doc['_id'])




db = Connection().test

top_100 = db.top_100_thread

thread = [a["thread"] for a in x]

for doc in thread:
    print doc

gives this error:

Traceback (most recent call last):
  File "C:\Users\chatterjees\workspace\de.vogella.python.first\src\top_100_thread.py",        line 21, in <module>
    print doc
  File "C:\Python27\lib\encodings\cp1252.py", line 12, in encode
   return codecs.charmap_encode(input,errors,encoding_table)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u03b9' in position 10:      character maps to <undefined>

what's going on?

Related Questions