Show More
@@ -21,7 +21,12 b' from __future__ import division, with_statement' | |||||
21 | import numpy as np |
|
21 | import numpy as np | |
22 | from matplotlib import pyplot as plt |
|
22 | from matplotlib import pyplot as plt | |
23 |
|
23 | |||
24 | # Top-level functions |
|
24 | try : #python2 | |
|
25 | from urllib import urlretrieve | |||
|
26 | except : #python3 | |||
|
27 | from urllib.request import urlretrieve | |||
|
28 | ||||
|
29 | # Top-level functions | |||
25 |
|
30 | |||
26 | def fetch_pi_file(filename): |
|
31 | def fetch_pi_file(filename): | |
27 | """This will download a segment of pi from super-computing.org |
|
32 | """This will download a segment of pi from super-computing.org | |
@@ -34,11 +39,7 b' def fetch_pi_file(filename):' | |||||
34 | return |
|
39 | return | |
35 | else: |
|
40 | else: | |
36 | # download it |
|
41 | # download it | |
37 | try : #python2 |
|
42 | urlretrieve(ftpdir+filename,filename) | |
38 | urllib.urlretrieve(ftpdir+filename,filename) |
|
|||
39 | except : #python3 |
|
|||
40 | import urllib.request |
|
|||
41 | urllib.request.urlretrieve(ftpdir+filename,filename) |
|
|||
42 |
|
43 | |||
43 | def compute_one_digit_freqs(filename): |
|
44 | def compute_one_digit_freqs(filename): | |
44 | """ |
|
45 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now