Get and Replace Index Value: Python String
Here is a Python string example. First, we will find the position(index) of each item in the string and then replace it with a value of your choosing. Get index and replace a value in Python string Str1 = "1A2A3ABBBB1111_KKKK" b= input("ENter Alpha") print("=======") count =0 l=len(Str1) for c in range(0,l): if Str1[c] == b: print(Str1[c]) count += 1 if count == 2: new_str =…
View On WordPress












