Python if 使用 in 做判断的示例

栏目:云星空知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

Python if 使用 in 做判断的示例


image.webp


def DataChanged(e):
    if e.Key == "FNumber" and e.NewValue <> "":#物料编码发生变化时
        PartNumber=this.Model.GetValue("FNumber")[0:4];#获取物料编码前4位
        #准备比较的列表
        partNumList=["P156","P173","B100","B200","X110","X120","X200","X201","X202","Q100","Q103","Q102","L200","J100","J102","J102","F510","K200","K202","K300","K300","F200","T100","F302","F303","F304","F306","C101","C800","C900","C200","C900"];
        if PartNumber in partNumList:#使用in做判断
            this.Model.SetValue("字段标识","可以赋值");#条件符合就赋值

#not in 同理  if PartNumber not in partNumList:  即不相等的条件。 

image.webp

Python if 使用 in 做判断的示例

def DataChanged(e): if e.Key == "FNumber" and e.NewValue <> "":#物料编码发生变化时 PartNumber=this.Model.GetValue("FNu...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息