My question is similar to excel formula to replace or stubstitute only text that starts with a certain letter but I need a code in Python. I am trying to do nested if but it only replaces the first character not the entire element.
Also the elements are alphanumeric
List= ['F43.9', 'F53.2', 'H10.9', 'H60.9',
'S83.6', 'S01.88', 'J18.9', 'K35.9', 'S42.20', 'J06.9'....]
So my desired output is:
List= ['qwe', 'qwe', 'equal', 'equal', 'chronic', 'chronic', 'liable', 'priority', 'chronic', 'liable',....]
where I need to replace all values starting with F
such as F43.9,F53.2,etc
. with "qwe"
. And similarly for different alphabets. There are 30,000 elements in the list with 600 unique values.