Python string replace the values
Ganesh Pal
ganesh1pal at gmail.com
Fri Sep 1 13:13:11 EDT 2017
In the fixed length string i.e "a0000",last 4 bits i.e "0000" should be
replaced by the user provided value ( the value is between 0001 + f f f f )
. I intend to form final_string using a fixed_string and an user provided
user_string
Example:
fixed_string = "a0000"
user_string ='1'
final string = fixed_string and user_string
Example :
"a0000" and "1" => a0001
"a0000" and "aa" => c00aa
PS : "and" this is not logical and it's just for example
If I concatenation using + or += or it's append the value at the end of
the string
>>> "a0000" + "1" ===> expected was a0001
'a00001'
I am on python 2.7 and Linux , any ideas that you recommend to handle
this
Regards,
Ganesh
More information about the Python-list
mailing list