Deprecation in String.joinfields()

Larry Bates larry.bates at websafe.com
Mon Sep 25 10:35:13 EDT 2006


Anoop wrote:
> Hi All,
> 
> I am getting the following error while trying to use deprecation
> 
> Please help
> 
>>>> li = ["a", "b", "mpilgrim", "z", "example"]
>>>> newname = string.joinfields (li[:-1], ".")
>>>> newname
> 'a.b.mpilgrim.z'
>>>> newname = li[:-1].joinfields(".")
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> AttributeError: 'list' object has no attribute 'joinfields'
> 
>>>> newname1 = string.join (li[:-1], ".")
>>>> newname1
> 'a.b.mpilgrim.z'
>>>> newname = li[:-1].joinfields(".")
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> AttributeError: 'list' object has no attribute 'join'
> 
> Thank you for your help
> 
> Anoop
> 
I think you want:

newname1='.'.join(li[:-1])

-Larry Bates



More information about the Python-list mailing list