about summary refs log tree commit diff stats
path: root/example/expression/expr_random.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2019-03-07 14:37:07 +0100
committerGitHub <noreply@github.com>2019-03-07 14:37:07 +0100
commit4c2320b46250a8d6f8774e1218544b72a154cd8e (patch)
treeb67e7b072439f84109bd39dad8ed7f3f135224f8 /example/expression/expr_random.py
parenteab809932871f91d6f4aa770fc321af9e156e0f5 (diff)
parent26c1075723a02984da6d3bc7423c5c0c43082dc3 (diff)
downloadmiasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.tar.gz
miasm-4c2320b46250a8d6f8774e1218544b72a154cd8e.zip
Merge pull request #990 from serpilliere/support_python2_python3
Support python2 python3
Diffstat (limited to 'example/expression/expr_random.py')
-rw-r--r--example/expression/expr_random.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/example/expression/expr_random.py b/example/expression/expr_random.py
index 66c09f2e..e1164f6f 100644
--- a/example/expression/expr_random.py
+++ b/example/expression/expr_random.py
@@ -1,22 +1,24 @@
+from __future__ import print_function
+from builtins import range
 import string
 import random
 
-from miasm2.expression.expression_helper import ExprRandom
+from miasm.expression.expression_helper import ExprRandom
 
-print "Simple expression generator\n"
+print("Simple expression generator\n")
 
 depth = 8
 seed = 0
 random.seed(seed)
 
-print "- An ID:"
-print ExprRandom.identifier()
-print "- A number:"
-print ExprRandom.number()
+print("- An ID:")
+print(ExprRandom.identifier())
+print("- A number:")
+print(ExprRandom.number())
 
-print "- 3 expressions (without cleaning expression cache):"
-for i in xrange(3):
-    print "\t%s\n" % ExprRandom.get(depth=depth, clean=False)
+print("- 3 expressions (without cleaning expression cache):")
+for i in range(3):
+    print("\t%s\n" % ExprRandom.get(depth=depth, clean=False))
 
 class ExprRandom_NoPerfect_NoReuse_UppercaseIdent(ExprRandom):
     """ExprRandom extension with:
@@ -27,8 +29,8 @@ class ExprRandom_NoPerfect_NoReuse_UppercaseIdent(ExprRandom):
 
     perfect_tree = False
     reuse_element = False
-    identifier_charset = string.uppercase
+    identifier_charset = string.ascii_uppercase
 
-print "- 3 expressions with a custom generator:"
-for i in xrange(3):
-    print "\t%s\n" % ExprRandom_NoPerfect_NoReuse_UppercaseIdent.get(depth=depth)
+print("- 3 expressions with a custom generator:")
+for i in range(3):
+    print("\t%s\n" % ExprRandom_NoPerfect_NoReuse_UppercaseIdent.get(depth=depth))