1
Beginner's Corner / Re: Creating a function that finds the average of a list in python
« on: September 01, 2015, 09:30:57 pm »
Thanks for not only putting the correct code but also pointing out what I did wrong! This really helped.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
def f(x):
d = []
if x == d:
return None
else:
sum = 0
for n in d:
sum = sum + n
length = len(d)
total = sum/length
print(total)
import urllib
import re
url = "http://blahblah.com"
regex = '<value>(.+?)</value>'
pattern = re.compile(regex)
htmlfile = urllib.urlopen(url)
htmltext = htmlfile.read()
value = re.findall(pattern,htmltext)
print value