Question about concatenation error
Terry Hancock
hancock at anansispaceworks.com
Wed Sep 7 14:22:00 EDT 2005
On Wednesday 07 September 2005 11:34 am, colonel wrote:
> I am new to python and I am confused as to why when I try to
> concatenate 3 strings, it isn't working properly.
>
> Here is the code:
I'm not taking the time to really study it, but at first
glance, the code looks like it's probably much more
complicated than it needs to be.
> ["http://www.slugnuts.com/['index.html']",
> "http://www.slugnuts.com/['movies.html']",
> "http://www.slugnuts.com/['ramblings.html']",
> "http://www.slugnuts.com/['sluggies.html']",
> "http://www.slugnuts.com/['movies.html']"]
The tail end of that is the string representation of
a list containing one string, not of that string. I
suspect you needed to use ''.join() somewhere. Or,
you could, in principle have indexed the list, since
you only want one member of it, e.g.:
>>> ['index.html'][0]
'index.html'
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Python-list
mailing list