当前位置: 首页>>代码示例>>Python>>正文


Python Interpreter.execute方法代码示例

本文整理汇总了Python中Interpreter.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Interpreter.execute方法的具体用法?Python Interpreter.execute怎么用?Python Interpreter.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interpreter的用法示例。


在下文中一共展示了Interpreter.execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test0

# 需要导入模块: import Interpreter [as 别名]
# 或者: from Interpreter import execute [as 别名]
def test0():
    '''test concatenation'''
    s = "13 Jan 2008 00:00:00 +0000"
    scripts = '''substr(value,indexOf(value,'START','NUM',1),12)+loop(value,"substr(value,-11,18)")+substr(value,12,-12)
'''
    a = Interpreter(scripts)
    print a.execute(s)
开发者ID:CDECatapult,项目名称:Web-Karma,代码行数:9,代码来源:testcase.py

示例2: test5

# 需要导入模块: import Interpreter [as 别名]
# 或者: from Interpreter import execute [as 别名]
def test5():
    '''test loop'''
    stript = '''substr(value,indexOf(value,'NUM','\.',1),indexOf(value,'\.','22',1))+'edu'+'/'+'images'+'/'+substr(value,indexOf(value,'ANY','NUM',-1),-12)+'/'+substr(value,indexOf(value,'START','NUM',1),-12)+substr(value,-9,-8)+substr(value,5,16)
'''
    value = "1978.43.8_1a.jpg"
    e = Interpreter(stript)
    print e.execute(value)
开发者ID:CDECatapult,项目名称:Web-Karma,代码行数:9,代码来源:testcase.py

示例3: test1

# 需要导入模块: import Interpreter [as 别名]
# 或者: from Interpreter import execute [as 别名]
def test1():
    '''test loop \"\" is used to post evaluation of a expression'''
    value = "International Bussiness Machine"
    expression = '''substr(value,indexOf(value,',','UWRD',-1),indexOf(value,'LWRD','END',-1))+substr(value,indexOf(value,'LWRD','SYB',1),-6)+substr(value,indexOf(value,'START','NUM',1),indexOf(value,'LWRD','SYB',-1))'''
    loopexp = "foreach(value.split(),\"substr(value,indexOf(value,'START','UWRD'),indexOf(value,'UWRD','LWRD'))\")"
    e = Interpreter(loopexp)
    print e.execute(value)
开发者ID:CDECatapult,项目名称:Web-Karma,代码行数:9,代码来源:testcase.py

示例4: test4

# 需要导入模块: import Interpreter [as 别名]
# 或者: from Interpreter import execute [as 别名]
def test4():
    '''test switch function'''
    condi1 = "len(value) < 10"
    condi2 = "len(value) < 10"
    loopexp1 = "foreach(value.split(),\"substr(value,indexOf(value,'START','UWRD'),indexOf(value,'UWRD','LWRD'))\")"
    loopexp2 = '''foreach(foreach(value.split(),\"substr(value,indexOf(value,'START','UWRD'),indexOf(value,'UWRD','LWRD'))\"),\"value+'see'\")'''
    tuplist = "[("+condi1+","+loopexp1+"),("+condi2+","+loopexp2+")]"
    sw = "switch("+tuplist+")"
    value = "International Bussiness Machine"
    e = Interpreter(sw)
    print e.execute(value)
开发者ID:CDECatapult,项目名称:Web-Karma,代码行数:13,代码来源:testcase.py

示例5: test3

# 需要导入模块: import Interpreter [as 别名]
# 或者: from Interpreter import execute [as 别名]
def test3():
    '''test embeded loop'''
    value = "International Bussiness Machine"
    loopexp = '''foreach(foreach(value.split(),\"substr(value,indexOf(value,'START','UWRD'),indexOf(value,'UWRD','LWRD'))\"),\"value+'See'\")'''
    e = Interpreter(loopexp)
    print e.execute(value)
开发者ID:CDECatapult,项目名称:Web-Karma,代码行数:8,代码来源:testcase.py


注:本文中的Interpreter.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。