regex for only numbers in string?
问题 I can't find the regex for strings containing only whitespaces or integers. The string is an input from user on keyboard. It can contain everything but \n (but it doesn't matter I guess), but we can focus on ASCII since it's supposed to be English sentences Here are some examples: OK: '1' '2 3' ' 3 56 ' '8888888 333' ' 039' not OK: 'a' '4 e' '874 1231 88 qqqq 99' ' shf ie sh f 8' I have this which finds the numbers: t = [int(i) for i in re.findall(r'\b\d+\b', text)] But I can't get the regex.