newb: Join two string variables
Robert Bauck Hamar
roberth+news at ifi.uio.no
Tue Dec 5 20:03:44 EST 2006
johnny wrote:
Please don't top post. Arrange your answer so that your comments follow what
you comment.
> In my code, I have the following:
>
> p = posixpath.basename(e).strip
make this:
p = posixpath.basename(e).strip()
> filename = download_dir+p
>
> I am getting the following error:
>
> filename = download_dir+p
> TypeError: cannot concatenate 'str' and 'builtin_function_or_method'
> objects
>
Which is correct. Because you forgot to _call_ strip, you just stored (a
reference to) strip itself in p, and not its return value.
(rest of message deleted, because I don't comment on it.)
--
Robert Bauck Hamar
Der er to regler for suksess:
1. Fortell aldri alt du vet.
- Roger H. Lincoln
More information about the Python-list
mailing list