//调用Python
import console;
console.log("必须在导入python库以前打开控制台,
python中的print函数才能支持控制台.")

import py2;

var pyCode = /**
def sign_request():
    from hashlib import sha1
    import hmac
    import binascii
    key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
    raw = "Hi There" # as specified by oauth
    hashed = hmac.new(key.encode("gbk"), raw.encode("gbk"), sha1)
    return binascii.b2a_base64(hashed.digest())[:-1].decode("gbk")
def permutations(items,r): 
    from itertools import permutations
    return list(permutations(items,r))
**/

//执行Python2 的代码
py2.exec( pyCode )

//调用Python2 __main__ 模块下的函数
console.log( py2.main.sign_request() )

//从 py2.main 模块获取 Python 创建的函数 
var pyList = py2.main.permutations(
	{"a","b","c"},
	//aardio 数值默认转为 Python 浮点数, 可使用 py2.int() 生成 Python 整数
	py2.int(2) 
);

console.pause()