On Sat, 2 Sep 2017 03:13 am, Ganesh Pal wrote:

> Example :
> 
>   "a0000" and "1" => a0001
> 
>   "a0000" and "aa" => c00aa

Why does the leading 'a' change to a 'c'? Is that a mistake? I'll assume its a
typo.

You want string slicing.

base = 'a0000'
extra = 'ab'
print( base[:-len(extra)] + extra )



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to