Re: Help parsing a text file

2011-09-01 Thread JT
On Monday, August 29, 2011 1:21:48 PM UTC-5, William Gill wrote:
> 
> I have a text file with XML like records that I need to parse.  By XML 
> like I mean records have proper opening and closing tags. but fields 
> don't have closing tags (they rely on line ends).  Not all fields appear 
> in all records, but they do adhere to a defined sequence.

lxml can parse XML and broken HTML (see http://lxml.de/parsing.html).

- James

-- 
Bulbflow: A Python framework for graph databases (http://bulbflow.com)
-- 
http://mail.python.org/mailman/listinfo/python-list


getting text out of an xml string

2011-03-04 Thread JT
Yo,

 So I have almost convinced a small program to do what I want it to
do.  One thing remains (at least, one thing I know of at the moment):
I am converting xml to some other format, and there are strings in the
xml like this.

The python:

elif v == "content":
print "content", a.childNodes[0].nodeValue

what gets printed:

content \u3c00note xml:space="preserve"\u3e00see forms in red inbox
\u3c00/note\u3e00

what this should say is "see forms in red inbox" because that is what
the the program whose xml file i am trying to convert, properly
displays, because that is what I typed in oh so long ago.  So my
question to you is, how can I convert this "enhanced" version to a
normal string?  Esp. since there is this "xml:space="preserve"" thing
in there ... I suspect the rest is just some unicode issue.  Thanks
for any help.

   J "long time no post" T
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting text out of an xml string

2011-03-04 Thread JT
On Mar 4, 9:30 pm, John Machin  wrote:

> Your data has been FUABARred (the first A being for Almost) -- the
> "\u3c00" and "\u3e00" were once "<" and ">" respectively. You will

Hi John,

   I realized that a few minutes after posting.  I then realized that
I could just extract the text between the stuff with \u3c00 xml
preserve etc, which I did; it was good enough since it was a one-off
affair, I had to convert a to-do list from one program to another.
Thanks for replying and sorry for the noise :-)

  JT
-- 
http://mail.python.org/mailman/listinfo/python-list


pycrypto rsa inverse of p modulo q

2005-11-04 Thread jt
Looking up into Crypto.PublicKey.RSA, I see there is a computed value
named "u" for which I can't see the use. The value of "u" is the
inverse of p modulo q, in the code:
obj.u = pubkey.inverse(obj.p, obj.q)
Can someone tell me where this value could be used in the RSA scheme?
(it is not used in the code anyway)

Thx,
-- 
jt

-- 
http://mail.python.org/mailman/listinfo/python-list