python 3 compatibility for examples/*.py files

add from __future__ import
print statement -> print() function
xrange -> range
map() -> list(map())
range() -> list(range())
StandardError -> Exception
This commit is contained in:
danielque
2023-08-10 13:25:36 +02:00
parent 597e606bde
commit 539fd060c2
35 changed files with 106 additions and 88 deletions

View File

@ -1,17 +1,19 @@
# simple test of gnu tool
# creates tmp.eps
from __future__ import absolute_import
g = gnu()
g("plot sin(x) with lines")
a = range(10)
a = list(range(10))
b = [3,6,2,5,7,3,6,5,3,1]
g.plot(a)
g.plot(a,b)
g.plot(a,b,b,a)
g.mplot(0,10,2,"tmp",a,b)
g.mplot(2,10,2,"tmp",a,b)
g.export("tmp.gnu",a,b)
@ -30,4 +32,4 @@ g.ylog()
g.save("tmp")
print "all done ... type CTRL-D to exit Pizza.py"
print("all done ... type CTRL-D to exit Pizza.py")