python How would I divide this? -
any ideas on how divide (trying average of something)
import re print(sum(float(re.sub(r"[^\d.]", "", post.text)) post in posts))
this works me.
import re posts = ['1test', '23test', '15test'] r = re.compile('(^\d)') print sum([float(r.match(post).group(1)) post in posts])/len(posts)
Comments
Post a Comment