omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Reading utf-8 csv-file throws ascii error

    Pythonista
    2
    3
    1878
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chri
      chri last edited by

      I am trying to read a csv-file. Both python and csv-file are stored on icloud.
      But Pythonista cannot read the file. Any ideas what causes this?
      I posted a screenshot here: https://imgur.com/a/RYnvJ

      Thank you!

      # coding: utf-8 
      
      import csv
      with open('file.csv', 'r') as f:
          reader = csv.reader(f)
          city_list = list(reader)
      
      1 Reply Last reply Reply Quote 0
      • brumm
        brumm last edited by

        with open('file.csv', 'r', encoding='utf-8') as f:
        
        chri 1 Reply Last reply Reply Quote 1
        • chri
          chri @brumm last edited by

          @brumm thanks, that did it

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors