How would I use re expressions to retrieve multiple number off of a column and line of a CSV file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How would I use re expressions to retrieve multiple number off of a column and line of a CSV file?

I have managed to open up the CSV file and get to a specific column and line. An example, my number could look like CCC123/637 or d123. I'm thinking I want to find all the sets of numbers in a line and stick them in an array so on the example above line[0] =[123,657] line[1]=[123]

4th Jun 2020, 3:48 PM
Charlie Crease-huggett
4 Answers
+ 3
One way could be this: split input at newline character, then split each substring at non-numeric characters
4th Jun 2020, 3:53 PM
Lisa
Lisa - avatar
+ 3
Charlie Crease-huggett Based on what Lisa rightly proposed, I would go about it like this: Edit: if you need it in int form, you can of course use map() on the fly when appending https://code.sololearn.com/cqbTEoclpbuL/?ref=app
4th Jun 2020, 4:02 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 1
That's exactly what I need perfect thank you 😁
4th Jun 2020, 4:04 PM
Charlie Crease-huggett
+ 1
I updated the code for if you needed int, instead of str being appended
4th Jun 2020, 4:50 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar