Reading specific characters from a file in Python -


suppose want read file in format:

2  300   234 2 3  23444 

if use readline() iterates on entire line. want read numbers nothing else. how should this??

you can use re module.

import re  numbers = re.findall('[0-9]+', readline()) 

it return numbers list.


Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -