473,320 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

parsing non-ascii characters

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
Nov 10 '08 #1
2 14904
On Nov 10, 1:13Â*pm, Ronn <ronn.r...@gmail.comwrote:
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/inte...-code-encoding

Read all of the tutorial.
is there a way to parse Non-ASCII characters in python?
This question is meaningless.
Nov 10 '08 #2
On Nov 10, 10:13Â*am, Ronn <ronn.r...@gmail.comwrote:
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 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Viktor Rosenfeld | last post by:
Hi, I need to create a parser for a Python project, and I'd like to use process kinda like lex/yacc. I've looked at various parsing packages online, but didn't find anything useful for me: -...
15
by: Freddie | last post by:
Happy new year! Since I have run out of alcohol, I'll ask a question that I haven't really worked out an answer for yet. Is there an elegant way to turn something like: > moo cow "farmer john"...
5
by: Andrew Lighten | last post by:
Hi all; I'm really struggling to get C# to do the right thing when parsing non-decimal strings as numbers. What I really want to be able to do is take a string containing an integer in any valid...
3
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story>...
8
by: pradeepsarathy | last post by:
Hi all, Does the SAX parser has eventhandlers for parsing xml schema. Can we parse the xml schema the same way as we parse the xml document using SAX Parser. Thanks in advance. -pradeep
4
by: Rick Walsh | last post by:
I have an HTML table in the following format: <table> <tr><td>Header 1</td><td>Header 2</td></tr> <tr><td>1</td><td>2</td></tr> <tr><td>3</td><td>4</td></tr> <tr><td>5</td><td>6</td></tr>...
0
by: Li-fan Chen | last post by:
Hi, We work with email in a large CRM solution and one of the email-related tasks that has plagued us is our decision to make use of a 3rd-party local-sourcer to work on the parsing of inbound...
0
by: anonymous | last post by:
Hi! My current task included date parsing and recognizing. It's not enough hard but there are some problems. A lot of standards of date exists at this time: ISO,ARPA...+non standard date...
8
by: Tarique | last post by:
Hello. #include<stdio.h> int main(void) { int i=- -2; printf("%d",i); return 0; }
3
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, I've come to the conclusion that a scripting language will make a fine solution for a feature that I want to program for an app. I do not expect any problems parsing the script the old...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.