cut strings and parse for images

2004-12-06 Thread Andreas Volz
Hi, I used SGMLParser to parse all href's in a html file. Now I need to cut some strings. For example: http://www.example.com/dir/example.html Now I like to cut the string, so that only domain and directory is left over. Expected result: http://www.example.com/dir/ I know how to do this in ba

Re: cut strings and parse for images

2004-12-06 Thread Andreas Volz
Am Mon, 06 Dec 2004 20:36:36 GMT schrieb Paul McGuire: > Check out the urlparse module (in std distribution). For images, you > can provide a default addressing scheme, so you can expand > "images/marine.jpg" relative to the current location. Ok, this looks good. But I'm a really newbie to pytho

regex syntax

2004-12-06 Thread Andreas Volz
Hi, ich kann nicht gut regex, aber für das nötigste reicht es eigentlich. Irgendwie komm ich aber mit der Syntax der re.* Befehle in Python nicht klar Vielleicht kann mir das an diesem Beispiel jemand zeigen: string = "bild.jpg" ich möchte jetzt einfach wissen ob in dem string ein ".jpg" vorkomm

Re: cut strings and parse for images

2004-12-07 Thread Andreas Volz
Am Tue, 07 Dec 2004 00:40:02 GMT schrieb Paul McGuire: > Is this in the ballpark of where you are trying to go? Yes, thanks. You helped me a lot. Andreas -- http://mail.python.org/mailman/listinfo/python-list

Re: regex syntax

2004-12-07 Thread Andreas Volz
Am Mon, 6 Dec 2004 17:24:35 -0800 (PST) schrieb [EMAIL PROTECTED]: > Ich kann nicht spricht Deutch, aber: Ahh! Sorry for this! It was a mistake :-( regards Andreas -- http://mail.python.org/mailman/listinfo/python-list

Re: regex syntax

2004-12-07 Thread Andreas Volz
Am 6 Dec 2004 17:43:21 -0800 schrieb [EMAIL PROTECTED]: > viel besser als das vergleichbare Regexp: > > >>> re.match('.*\.jpg$', filename) Ok,now I've choosen this regex: > '.*\.(?i)jpe?g' to get .jpg .JPG .jpeg .JPEG seems to work. Is this correct? regards Andreas -- http://mail.python.or

regex for url paramter

2004-12-07 Thread Andreas Volz
Hi, I try to extract a http target from a URL that is given as parameter. urlparse couldn't really help me. I tried it like this url="http://www.example.com/example.html?url=http://www.example.org/exa mple.html" p = re.compile( '.*url=') url = p.sub( '', url) print url > http://www.example.org/e