changeset 10:ee4124570098

Add example/random_num.py
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 29 Mar 2011 01:27:39 +0800
parents 053bf888d5a3
children d30e2253c3d6
files example/random_num.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/example/random_num.py	Tue Mar 29 01:27:39 2011 +0800
@@ -0,0 +1,10 @@
+import random
+from shada.pysh import run
+
+def rand(args, env, session):
+    num = random.randint(0, 1024)
+    session.send(str(num))
+    session.exit(0)
+    pass
+
+run('echo random number `$py rand`')