parsing non-ascii characters

Discussion in 'Python' started by Ronn, Nov 10, 2008.

  1. Ronn

    Ronn Guest

    Hello all,

    I have a list:
    suffix = ["aĉ", "ad", "aĵ", "an", "ar"]

    and I'm trying to check a word to see if any of the suffixes exist in
    the list for example:
    if word in suffix:
    print "A suffix exist in your word"

    when I run this it give me an error:
    SyntaxError: Non-ASCII character '\xc5' in file vortaro.py on line
    33, but no encoding declared;

    is there a way to parse Non-ASCII characters in python?

    Thanks in advance,
    Ronn
    Ronn, Nov 10, 2008
    #1
    1. Advertising

  2. Ronn

    John Machin Guest

    On Nov 10, 1:13 pm, Ronn <> wrote:
    > Hello all,
    >
    > I have a list:
    >   suffix = ["aĉ", "ad", "aĵ", "an", "ar"]
    >
    > and I'm trying to check a word to see if any of the suffixes exist in
    > the list for example:
    >   if word in suffix:
    >       print "A suffix exist in your word"
    >
    > when I run this it give me an error:
    >    SyntaxError: Non-ASCII character '\xc5' in file vortaro.py on line
    > 33, but no encoding declared;


    Read this:
    http://docs.python.org/tutorial/interpreter.html#source-code-encoding

    Read all of the tutorial.

    > is there a way to parse Non-ASCII characters in python?


    This question is meaningless.
    John Machin, Nov 10, 2008
    #2
    1. Advertising

  3. Ronn

    Ò»Ê×Ê« Guest

    On Nov 10, 10:13 am, Ronn <> wrote:
    > Hello all,
    >
    > I have a list:
    >   suffix = ["aĉ", "ad", "aĵ", "an", "ar"]
    >
    > and I'm trying to check a word to see if any of the suffixes exist in
    > the list for example:
    >   if word in suffix:
    >       print "A suffix exist in your word"
    >
    > when I run this it give me an error:
    >    SyntaxError: Non-ASCII character '\xc5' in file vortaro.py on line
    > 33, but no encoding declared;
    >
    > is there a way to parse Non-ASCII characters in python?
    >
    > Thanks in advance,
    > Ronn


    http://www.python.org/dev/peps/pep-0263/
    Ò»Ê×Ê«, Nov 10, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TOXiC
    Replies:
    5
    Views:
    1,221
    TOXiC
    Jan 31, 2007
  2. Laszlo Nagy
    Replies:
    6
    Views:
    600
  3. Alextophi
    Replies:
    8
    Views:
    484
    Alan J. Flavell
    Dec 30, 2005
  4. bruce
    Replies:
    38
    Views:
    258
    Mark Lawrence
    Nov 1, 2013
  5. MRAB
    Replies:
    0
    Views:
    86
Loading...

Share This Page