>>> import re
>>> string1 = "498results should get"
>>> int(re.search(r'\d+', string1).group())
498
If there are multiple integers in the string:
>>> map(int, re.findall(r'\d+', string1))
[498]
More Related Contents:
- How to convert strings into integers?
- Is there a way to convert number words to Integers?
- Python: TypeError: cannot concatenate ‘str’ and ‘int’ objects [duplicate]
- Converting integer to string in Python
- Python strings and integer concatenation [duplicate]
- How to split a string of space separated numbers into integers?
- How can I check if a string represents an int, without using try/except?
- inheritance from str or int
- formatting long numbers as strings in python
- How do I convert all strings in a list of lists to integers?
- Convert integer to string in Python
- TypeError: cannot concatenate ‘str’ and ‘int’ objects [duplicate]
- How to convert a string of space- and comma- separated numbers into a list of int? [duplicate]
- Splitting List That Contains Strings and Integers
- How do I check if raw input is integer in python 2.7?
- Convert a string to integer with decimal in Python
- Formatting long numbers as strings
- How can I convert string values from a dictionary, into int/float datatypes?
- How can I check if a string has a numeric value in it in Python? [duplicate]
- Check if multiple strings exist in another string
- How to use string.replace() in python 3.x
- Create nice column output in python
- Find the nth occurrence of substring in a string
- What is the max length of a Python string?
- How can I extract keywords from a Python format string?
- How to get an expression between balanced parentheses
- Parsing json and searching through it
- f.read coming up empty
- What is internal representation of string in Python 3.x
- Sort strings by the first N characters