Better way to sift parts of URL . . .

Ben Wilson dausha at gmail.com
Tue Apr 18 18:03:41 EDT 2006


Sorry.

I'm writing a python script that retrieves source contents of a wiki
page, edits, and re-posts changed content. The wiki breaks pages into
groups and pages (e.g. ThisGroup/ThisPage). The sections that are
camel cased (or otherwise contain title case) are the group and page
for a given page. When a url is passed that is incomplete (i.e., has
the base URL and the Group, or only the base URL), the wiki resorts to
defaults (e.g. a base URL and Group would return the default page for
that group, and a bare URL returns the base page for the base group).

I'm playing with urlparse now. Looks like I can do the same thing in a
lot fewer steps. I'll post results.

Ben

On 4/18/06, skip at pobox.com <skip at pobox.com> wrote:
>
>     Ben> I am working on a script that splits a URL into a page and a
>     Ben> url.
>
> I couldn't tell quite what you mean to accomplish from your example.  (In
> particular, I don't know what you mean by "default_group", as it's never
> defined, and I don't know why the desired output of examples 1 and 6 is the
> same, since the URLs are clearly different.)  You don't mention having tried
> the urlparse module, so I thought I should ask: have you tried using
> urlparse?
>
> Skip
>


--
Ben Wilson
" Mundus vult decipi, ergo decipiatur"



More information about the Python-list mailing list