I agree with Stephen Ans. this is not odoo question this is related to python code. you can right python code to replace your later.
Here you Go! I have written sample method which will swap your latter in string. this will not only work for your number 3 and number 1.
I have written dynamic progrma which will ask for user Input which latter to be replace in string.
def swap_letter( a, b, dt):
left_val_idx = 
right_val_idx = 
for d in dt:
if d == a:
elif d == b:
swaped_word = ""
for d in dt:
if dt.index(d) in left_val_idx:
swaped_word += b
elif dt.index(d) in right_val_idx:
swaped_word += a
swaped_word += d
data = "686934543222133457768"
#Pass your two latter to be swap in string/word and your string as argument This will work for any case.
swap_data = swap_letter("8","9", data)
print "Swap DData ::",swap_data
Hope this will help.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 2/3/15, 5:59 AM|
|Seen: 661 times|
|Last updated: 3/16/15, 8:10 AM|