一、random 模块,formate
:random() 方法返回随机生成的一个实数,它在[0,1)范围内。
execjs.get().name
#formate
>>>"{} {}".format("hello", "world") # 不设置指定位置,按默认顺序
'hello world'
>>> "{0} {1}".format("hello", "world") # 设置指定位置
'hello world'
>>> "{1} {0} {1}".format("hello", "world") # 设置指定位置
'world hello world'
二、execjs
通过运行时环境运行js:
default = execjs.get()
default.eval(“1 + 2”)
结果:
[‘red’, ‘yellow’, ‘blue’]
js文件一般写在另一个文件中后续通过node.compile(open(’./filena’,encoding=‘utf-8’).read())来调用
三、时间戳
https://blog.youkuaiyun.com/BcXbHello/article/details/111060606
引用
https://blog.youkuaiyun.com/BcXbHello/article/details/111060606