I have a list:
my_list = ['element10238.94', 'element22.3904', 'element30139847']
How can I delete the and everything after to get this result:
['element1', 'element2', 'element3']
Something like:
>>> l = ['element10238.94', 'element22.3904', 'element30139847'] >>> [i.split('', 1)[0] for i in l] ['element1', 'element2', 'element3']
2.1m questions
2.1m answers
60 comments
57.0k users