Show More
@@ -17,9 +17,9 b' from IPython.parallel import Client, Reference' | |||||
17 |
|
17 | |||
18 | from __future__ import division |
|
18 | from __future__ import division | |
19 |
|
19 | |||
20 |
try |
|
20 | try: #python2 | |
21 | from urllib import urlretrieve |
|
21 | from urllib import urlretrieve | |
22 | except : #python3 |
|
22 | except ImportError: #python3 | |
23 | from urllib.request import urlretrieve |
|
23 | from urllib.request import urlretrieve | |
24 |
|
24 | |||
25 | davinci_url = "http://www.gutenberg.org/cache/epub/5000/pg5000.txt" |
|
25 | davinci_url = "http://www.gutenberg.org/cache/epub/5000/pg5000.txt" | |
@@ -76,9 +76,9 b" if __name__ == '__main__':" | |||||
76 | with open('davinci%i.txt'%i, 'w') as f: |
|
76 | with open('davinci%i.txt'%i, 'w') as f: | |
77 | f.write('\n'.join(chunk)) |
|
77 | f.write('\n'.join(chunk)) | |
78 |
|
78 | |||
79 |
try |
|
79 | try: #python2 | |
80 | cwd = os.path.abspath(os.getcwdu()) |
|
80 | cwd = os.path.abspath(os.getcwdu()) | |
81 | except : #python3 |
|
81 | except AttributeError: #python3 | |
82 | cwd = os.path.abspath(os.getcwd()) |
|
82 | cwd = os.path.abspath(os.getcwd()) | |
83 | fnames = [ os.path.join(cwd, 'davinci%i.txt'%i) for i in range(n)] |
|
83 | fnames = [ os.path.join(cwd, 'davinci%i.txt'%i) for i in range(n)] | |
84 | tic = time.time() |
|
84 | tic = time.time() |
@@ -23,7 +23,7 b' from matplotlib import pyplot as plt' | |||||
23 |
|
23 | |||
24 | try : #python2 |
|
24 | try : #python2 | |
25 | from urllib import urlretrieve |
|
25 | from urllib import urlretrieve | |
26 | except : #python3 |
|
26 | except ImportError : #python3 | |
27 | from urllib.request import urlretrieve |
|
27 | from urllib.request import urlretrieve | |
28 |
|
28 | |||
29 | # Top-level functions |
|
29 | # Top-level functions |
General Comments 0
You need to be logged in to leave comments.
Login now