0

How to? Python.

How do i change the 2nd elements first letter to another in list? When i tried there was only one letter left.

29th Nov 2018, 8:13 PM
Leaf
Leaf - avatar
4 Respostas
+ 1
If you have list with strings you can use replace() ex : list[0]=list[0].replace('o','a') But there is also another approach , like convert string to list , modify and then put it back together in string
29th Nov 2018, 8:37 PM
kit
+ 1
Or even easyer , you can do like this : list[0]= 'X'+list[0][1:]
29th Nov 2018, 8:42 PM
kit
0
Thank you alot
29th Nov 2018, 8:44 PM
Leaf
Leaf - avatar
0
Hi Leaf Has your problem been resolved? I didn't completely understand your question. If you're still having issues, please share an example of what you're trying to achieve. Thanks. :)
30th Nov 2018, 3:16 AM
Kishalaya Saha
Kishalaya Saha - avatar