Split string with numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Split string with numbers

I need help to create a list of a String that contains numbers: Example with that string "2019hello2bye2018" I get ['2019', 'hello', '2', 'bye', '2018']. With the re achieve the numbers split = [int (s) for s in re.findall (r '-? \ D + \.? \ D *', self.value)], but I do not know how to get everything. Thank you!

2nd Jan 2019, 12:49 PM
Ramphy Aquino Nova
Ramphy Aquino Nova - avatar
0 Answers