johnny wrote:
> How do I join two string variables?
> I want to do: download_dir + filename.
> download_dir=r'c:/download/'
> filename =r'log.txt'
>
> I want to get something like this:
> c:/download/log.txt
pathfn = download_dir+filename
--
http://mail.python.org/mailman/listinfo/python-list
johnny wrote:
> In my code, I have the following:
>
> 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
>
>
You need to *call* the strip
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:
>
>
In my code, I have the following:
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
Cameron Walsh wrote:
> johnny wrote:
> > How do I join two strin
johnny wrote:
> How do I join two string variables?
> I want to do: download_dir + filename.
> download_dir=r'c:/download/'
> filename =r'log.txt'
>
> I want to get something like this:
> c:/download/log.txt
>
Hi Johnny,
This is actually two questions:
1.) How do I concatenate strings
2.)
johnny wrote:
> How do I join two string variables?
> I want to do: download_dir + filename.
That should do it. :-)
You can concatenate strings using the plus operator. For large number
of strings it is very inefficient. (Particularly in versions of Python
pre 2.4 or in IronPython.)
For these
How do I join two string variables?
I want to do: download_dir + filename.
download_dir=r'c:/download/'
filename =r'log.txt'
I want to get something like this:
c:/download/log.txt
--
http://mail.python.org/mailman/listinfo/python-list