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

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -