Python Regular Expression example

前端 未结 9 1539
天命终不由人
天命终不由人 2020-12-08 10:04

I want to write a simple regular expression in Python that extracts a number from HTML. The HTML sample is as follows:

Your number is 123
         


        
9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 10:35

    The simplest way is just extract digit(number)

    re.search(r"\d+",text)
    

提交回复
热议问题