"rU")
try:
# Skip the first line; make the second available for processing
in_file.readline()
in_line = readline()
attribute_count = in_line.count('",')
print attribute_count
finally:
in_file.close()
Any suggestions?
Richard Schulman
(For
"rU")
try:
# Skip the first line; make the second available for processing
in_file.readline()
in_line = in_file.readline()
attribute_count = in_line.count('",')
print attribute_count
finally:
in_file.close()
Any suggestions?
Richard Schulman
Thanks for your excellent debugging suggestions, John. See below for
my follow-up:
Richard Schulman:
>> The following program fragment works correctly with an ascii input
>> file.
>>
>> But the file I actually want to process is Unicode (utf-16 encoding).
>> The fi
On 5 Sep 2006 19:50:27 -0700, "John Roth" <[EMAIL PROTECTED]>
wrote:
>> [T]he file I actually want to process is Unicode (utf-16 encoding).
>>...
>> in_file = open("c:\\pythonapps\\in-graf1.my","rU")
>>...
John Roth:
>You're not detecting the file encoding and then
>using it in the open statement
On Wed, 06 Sep 2006 03:55:18 GMT, Richard Schulman
<[EMAIL PROTECTED]> wrote:
>...I'm now using the codec with
>improved results, but am still puzzled as to how to handle the row
>termination of \n\n, which is being interpreted as two rows instead of
>one.
Of course, I co
ut how difficult it is to cook challenging dishes with sketchy
recipes alone. There is no substitute for the helpful advice of an
experienced chef.
-Richard Schulman
(remove "xx" for email reply)
On 5 Sep 2006 22:29:59 -0700, "John Machin" <[EMAIL PROTECTED]>
hat. If this causes a problem, email me and I'll
send you the source directly.
-Richard Schulman
/* This program converts an input file of one encoding format to
an output file of
* another format. It will be mainly used to convert Big5 text
files to Unicode text files.
*
lect mean_eng_txt from mean where
mean_id=:arg_1',arg_1)
TypeError: expecting a dictionary, sequence or keyword args
What do I need to do to get this sort of program working?
TIA,
Richard Schulman
For email reply, remove the xx characters
--
http://mail.python.org/mailman/listinfo/python-list
Richard Schulman:
>> cursor.execute("""select mean_eng_txt from mean
>> where mean_id=:arg_1""",arg_1)
Uwe Hoffman:
>cursor.execute("""select mean_eng_txt from mean
>where mean_id=:arg_1"
=mean)
I not surprisingly get this error message:
"cx_Oracle.NotSupportedError: Variable_TypeByValue(): unhandled data
type unicode"
But when I try putting a codecs.BOM_UTF16_LE in various plausible
places, I just end up generating different errors.
Recommendations, please?
TIA,
Ric
pps\LoadMeanToOra.py", line 23, in ?
cursor.execute("""INSERT INTO mean (mean_id,mean_eng_txt)
What I can't figure out is whether cx_Oracle is saying it can't handle
Unicode for an Oracle nvarchar2 data type or whether it can handle the
input but that it needs to be in a specific format that I'm not
supplying.
- Richard Schulman
--
http://mail.python.org/mailman/listinfo/python-list
much as I dislike Java and C#'s complexities and the poor
support available for all-Java databases.
>Then you need to encode the unicode string before passing it - something
>like this:
>
>mean = mean.encode("latin1")
I don't see how the Chinese characters embedded in the English text
will carry over if I do that.
In any case, thanks for your patient and generous help.
Richard Schulman
Delete the antispamming 'xx' characters for email reply
--
http://mail.python.org/mailman/listinfo/python-list
ivePython 2.4 documentation, which states:
<<12.20 csv -- CSV File Reading and Writing
<>
Regards,
Richard Schulman
--
http://mail.python.org/mailman/listinfo/python-list
13 matches
Mail list logo