Thank you for your quick answers. I've tried what you recommended me. My 
code is like that now:

import unicodecsv as csv

csvfile=open("mediosdigitales.csv")
reader = csv.reader(csvfile, encoding='utf-8', delimiter=',')
for row in reader:
    titulo=row['titulo']
    pais=row['pais']
    print titulo
    print pais

However, when I compile it I get this error: *list indices must be 
integers, not str*

How could I solve this problem?

Thank you again

El sábado, 6 de febrero de 2016, 3:14:01 (UTC+1), elcaiaimar escribió:
>
> Hello,
>
> I have a CSV File and I want read it. The problem is that it has non ASCII 
> characters such as 'Ñ' and accents and I need that they are recognised to 
> save the CSV content in a DB.
>
> To simplify, I've summed up my code in django to the next:
>
> ​import csv
>
> reader = csv.DictReader(open("file.csv", "rb"))
> for row in reader:
>     title=row['title']
>     country=row['country']
>     print title
>     print country
>
> This code returns, for example: Espa�a or Mediterr�neo and I want to get 
> España or Mediterráneo.
>
> Thank you very much!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fa59d6cd-588e-4754-aa97-a8ca9a5f6e5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to