Extract string from HTML String

后端 未结 5 680
名媛妹妹
名媛妹妹 2021-01-26 04:26

i want to extract a number from a html string (i usually do not know the number).

The crucial part looks like this:



        
5条回答
  •  生来不讨喜
    2021-01-26 05:02

    in your view.py document you can try this:

    import re
    my_string="TOTAL : 286"
    int(re.search(r'\d+', my_string).group())
    

    286

提交回复
热议问题