Hi all,
I've been struggling with this for a while so I'm hoping that someone
could point me in the right direction. Here's my problem: I'm trying to
get the XPath for a given node in my document and then store that XPath
as an attribute of the element itself. If anyone has a recommendation
I'd be
Hi,
I'm looking for a little advice about regular expressions. I want to
capture a string of text that falls between an opening squre bracket
and a closing square bracket (e.g., "[" and "]") but I've run into a
small problem.
I've been using this: '''\[(.*?)\]''' as my pattern. I was expecting
th
Thanks again and sorry about the lack of examples. It didn't even occur
to me that my example wasn't comprehensive enough when I posted my
first message but I can see the issue now.
Your solution is really helpful for me to see. I can't tell you how
much I apprecaite it. I thought that adding more
Thanks very much for this I really appreciate it. I've pasted what I've
got now thanks to you.
I only have one issue that I can't figure out. When I print the new
string I'm getting all of the values in the lt list rather than just
the one that corresponds to the original entry.
E.g.,
My origina
I'm totally stumped by this problem so I'm hoping someone can give me a
little advice or point me in the right direction.
I have a file that looks like this:
APPEAL40-24; 40-46; 42-46; 42-48; 42-62; 42-63 PROC
GUIDE921(b)(1)
(i.e., <[chapter name][multiple or single book page
ranges][chapter nam
I understand that but I'm still puzzled. Is this the reason why I can't
write files to this directory?
The xrefs directory is created the way I expect it would be using mkdir
but I can't seem to write to it. I thought that my results would be
written to the xrefs directory here but they're ending
Hi,
I'm trying to write a script that will create a new directory and then
write the results to this newly created directory but it doesn't seem
to work for me and I don't know why. I'm hoping someone can see my
mistake or at least point me in the right direction.
I start like this capturing the
Hi,
I've always struggled with classes and this one is no exception.
I'm working in an SGML file and I want to renumber a couple of elements
in the hierarchy based on the previous level.
E.g.,
My document looks like this
A. Title Text
1. Title Text
1. Title Text
1. Title Text
B. Title Text
1.
Thanks for this but I'm still getting an "empty" character (I don't
know what else to call it) rather than the text captured by my regular
expression in my replaced text.
I even added the utf encoding declaration to my input data but still no
luck.
Any suggestions?
--
http://mail.python.org/mai
Hi,
I'm hoping someone can help me. I'm hopelessly lost.
I'm trying to make a change in some XML files using a regular
expression (re.sub). I can capture the text I want to replace OK but
when I replace it end up with nothing: i.e., just a "" character in my
file.
data = re.sub(r'(?i)(?u)Sample
Hi,
I've experimented with regular expressions to solve my problems in the
past but I have seen so many comments about HTMLParser and sgmllib that
I thought I would try a different approach this time so I tried using
HTMLParser.
I want to search through my SGML file for various strings of text an
Thanks very much for your help. It's greatly appreciated.
It look a couple of tries to see what was happening but I've figured
it out.
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Thanks. One more question, though.
I'm not sure how to limit the scope of my search so that I'm just
extracting the id attribute from the sections that I want. I.e., I want
the id attributes from the forms in sections 1 and 3 but not from 2.
Maybe I'm missing something.
--
http://mail.python.or
Hi,
I'm trying to write a script that will extract the value of an
attribute from an element using the attribute value of another element
as the basis for extraction.
For example, in my situation I have a pre-defined list of main sections
and I want to extract the id attribute of the form element
Hi,
Would anyone be willing to give me some feedback about this little
script that I wrote to convert CSV to XML. I'll happily admit that I
still have a lot to learn about Python so I'm always grateful for
constructive feedback.
Thanks,
Greg
###
#csv to XML conversion utility
import os, re, c
Hi,
I'm learning more and more about Python all the time but I'm still a
real newbie. I wrote this little script to convert CSV to XML and I was
hoping to get some feedback on it if anyone was willing to comment.
It works but I was wondering if there was anything I could do better.
E.g., incorpor
Thanks again. This is very helpful.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks so much. I never would have been able to figure this out on my
own.
def dictionary_join(one, two):
dict2x = dict( ((dict2[k], k) for k in dict2.iterkeys()))
dict3 = dict(((k, dict2x[v]) for k,v in dict1.iteritems()))
print dict3
dict1 = {1:'bbb', 2:'aaa', 3:'ccc'}
dict2 =
I'm still learning python so this might be a crazy question but I
thought I would ask anyway. Can anyone tell me if it is possible to
join two dictionaries together to create a new dictionary using the
keys from the old dictionaries?
The keys in the new dictionary would be the keys from the old
di
Hi,
I'm trying to create a script that will search an SGML file for the
numbers and titles of the hierarchical elements (section level
headings) and create a dictionary with the section number as the key
and the title as the value.
I've managed to make some progress but I'd like to get some gener
I have a newbie count question.
I have a number of SGML documents divided into sections but over the
course of editing them the some sections have been deleted (and perhaps
others added). I'd like to renumber them. The input documents look like
this:
and after renumbering I would li
21 matches
Mail list logo