Python selenium string to int -
i've tried of examples on stackoverflow can't find way. have 2 questions, how make string text..
posts = driver.find_elements_by_class_name("currency-chaos") numberofitems = 1 post in posts: numberofitems = numberofitems + 1 print(numberofitems) print(post.text)
and how remove letter text, transfer int?
you use regular expression remove non digit characters , parse number float
:
import re value = float(re.sub(r"[^\d.]", "", post.text)) print("value: %s" % value)
Comments
Post a Comment