string.join question (was Re: urllib question)

paul at fizzylab.com paul at fizzylab.com
Sun Jun 18 00:28:42 EDT 2000


Nothing. That's the problem. The item I want to append to the first never gets
evaluated/appended. I get the first item -- the host name -- and I make a valid
request for the root of the webserver, not what I want. It's as if I requested
'http://www.site.com/' rather than 'http://www.site.com/thispage.html'  which is
not what I want.

See the code I submitted initially . . . . the first example works, the second
does not.

#!/usr/bin/python
import string, urllib

u = urllib.urlopen(string.join(["http://cnn.com/","index.html"]))
print u.read()
u =
urllib.urlopen(string.join(["http://some.host.com/","monstrousQueryString?withParameters"]))

print u.read()

I added an additional loop to ask for a flat html page (no query string), still
no joy. I made a telnet connection to port 80 and requested the page, no problem.

If I omit the string.join and request the page, it works fine.
u = urllib.urlopen("http://some.host.com/monstrousQueryString?withParameters")
print u.read()

This suggests something in the join is not working. And the webserver log just
tells me there was no second item to be joined/requested.

Don't make me do this in perl.

Aahz Maruch wrote:

> In article <Pine.LNX.4.10.10006171424430.19831-100000 at mail.fizzylab.com>,
> paul beard  <paul at fizzylab.com> wrote:
> >
> >The length isn't the issue. I'm not able to do the string.join for some
> >reason. I need to feed many URLs from a common host. I have the URLs (from
> >an access log) and want to just append the URL to the host.
>
> What happens when you do a string.join()?
> --
>                       --- Aahz (Copyright 2000 by aahz at netcom.com)
>
> Androgynous poly kinky vanilla queer het    <*>    http://www.rahul.net/aahz/
> Hugs and backrubs -- I break Rule 6
>
> "The only problem with Microsoft is they just have no taste." --Steve Jobs
> (From _Triumph of the Nerds_ PBS special)




More information about the Python-list mailing list