I try to scrape a page and I have problems to check if the one beautifulsoup element contains numbers. I would like to clean the string, if it contains numbers. In this case, i would like just to keep the number, which is a zipcode. But before I clean it, I have to check, if the element even has a zipcode.
I search the element with following code:
soup.find("span",{"class": "locality"}).get_text()
Output: 68549 Ilvesheim, Baden-Württemberg,
I tried to check the string with following code, but it always says "False"
soup.find("span",{"class": "locality"}).get_text()).isalnum()
soup.find("span",{"class": "locality"}).get_text()).isdigit()
is there another way to check it? Since it contains "68549" it should say TRUE