How to remove the last character from all the strings in a list of strings with Python

1 Answer

0 votes
lst = ["python", "java", "PHP", "c#", "pascal"] 
 
lst = [ele[: -1] for ele in lst] 
 
print(lst) 
 
 
 
'''
run:
 
['pytho', 'jav', 'PH', 'c', 'pasca']
 
'''

 



answered Jan 13, 2020 by avibootz
...