Running NumPy code in a Python Anywhere web console
In Chapter 1, we already saw a Python Anywhere console in action, without having an account. This recipe will require you to have an account, but don't worry—it's free; at least if you don't need too many resources.
Signing up is a pretty straightforward process and will not be covered here. NumPy is already installed along with a long list of other Python software. For a complete list, see https://www.pythonanywhere.com/batteries_included/.
We will setup a simple script that gets price data from Google Finance every minute, and does simple statistics with the prices using NumPy.
How to do it...
Once we have signed up, we can login and have a look at the Python Anywhere dashboard:
Write the code.
The complete code for this example is as follows:
import urllib2 import re import time import sys import numpy prices = numpy.array([]) for i in xrange(3): req = urllib2.Request('http://finance.google.com/finance/info?client=ig&q=' + sys.argv...