Can somebody suggest a way in python to replace only alphabetic characters from first list with second list alphabets ??
(alphabets are always in uppercase)
L1=[’@’, ‘T’, ‘U’, ‘U’, ‘W’, ‘Y’, ’ ', ‘D’, ‘Y’, ‘U’, ‘@’, ’ ', 9,9]
L2=[‘X’, ‘W’, ‘O’, ‘P’, ‘K’, ‘A’, ‘X’, ‘B’]
Expected output:
[’@’, ‘X’, ‘W’ ,‘O’, ‘P’, ‘K’, ’ ’ , ‘A’, ‘X’, ‘B’, ‘@’, ’ ’ ,9 ,9]
i tried doing it by first converting L1 to string,then reversed it,
L1. reverse()
L1=str(L1)
iterated over L1 and by put condition if( ord(i)>=65 and ord(i) <=90) then
L1= L1. replace(i, L2. pop(), 1)
but then even though special character position is correct in output… the characters are not in same order as the expected output