B
bilgin arslan
Hello,
I am trying to write a list of words to into a text file as two
colons: word (tab) len(word)
such as
standart 8
I have no trouble writing the words but I couldn't write integers. I
always get strange characters, such as:
GUN
ãŠå¨€ä„€ä´€ä„€ä¸€à´€à¨€5COCUK
ãŠä¬€ä„€ä€ä¤€ä¸€à´€à¨€5EV
....
㜊夀䄀䴀䄀ഀ਀4YATSI
㔊娀䤀䰀䜀䤀å€à´€à¨€ï¿½
(the integers also seem to be incorrect)
I use the following form inside a loop to produce this
current = unicode(word)+" "+str(len(word))
ofile.write(current)
I know about struct and I tried to used it but somehow I always got a
blank character instead of an int.
import struct
format = "i"
data = struct.pack(format, 24)
print data
Any ideas?
I use macosx and eclipse. The code also uses unicode encoding
I am trying to write a list of words to into a text file as two
colons: word (tab) len(word)
such as
standart 8
I have no trouble writing the words but I couldn't write integers. I
always get strange characters, such as:
GUN
ãŠå¨€ä„€ä´€ä„€ä¸€à´€à¨€5COCUK
ãŠä¬€ä„€ä€ä¤€ä¸€à´€à¨€5EV
....
㜊夀䄀䴀䄀ഀ਀4YATSI
㔊娀䤀䰀䜀䤀å€à´€à¨€ï¿½
(the integers also seem to be incorrect)
I use the following form inside a loop to produce this
current = unicode(word)+" "+str(len(word))
ofile.write(current)
I know about struct and I tried to used it but somehow I always got a
blank character instead of an int.
import struct
format = "i"
data = struct.pack(format, 24)
print data
Any ideas?
I use macosx and eclipse. The code also uses unicode encoding