A Unicode problem -HELP

"Martin v. Löwis" martin at v.loewis.de
Wed May 17 01:08:54 EDT 2006


manstey wrote:
> input_file = open(input_file_loc, 'r')
> output_file = open(output_file_loc, 'w')
> for line in input_file:
>     output_file.write(str(word_info + parse + gloss))  # = three
> functions that return tuples
> 
> (u'F', u'\u0254')  are two of the many unicode tuple elements returned
> by the three functions.
> 
> What am I doing wrong?

Well, the primary problem is that you don't tell us what you are really
doing. For example, it is very hard to believe that this is the actual
code that you are running:

If word_info, parse, and gloss are functions, the code should read

input_file = open(input_file_loc, 'r')
output_file = open(output_file_loc, 'w')
for line in input_file:
    output_file.write(str(word_info() + parse() + gloss()))

I.e. you need to call the functions for this code to make any sense.
You have probably chosen to edit the code in order to not show us
your real code. Unfortunately, since you are a newbie in Python,
you make errors in doing so, and omit important details. That makes
it very difficult to help you.

Regards,
Martin



More information about the Python-list mailing list