我正在使用下面的 XML,我需要在 XML 中为下面的标签设置 10 次值。

  1. 投票号码

而且我还想用 10 个更新的新 Po,karate,feature-file"/>

首页 > 解决方案 >

我正在使用下面的 XML,我需要在 XML 中为下面的标签设置 10 次值。

  1. 投票号码

而且我还想用 10 个更新的新 Po

问题描述

我正在使用下面的 XML,我需要在 XML 中为下面的标签设置 10 次值。

  1. 投票号码

而且我还想用 10 个更新的新 PolNumber 打印新的 XML。我应该在这个 SOAP XML 的特性文件中写什么?

我已经写了下面的代码,但是新更新的值没有被打印出来。

  • def Info = read('data.xml')
  • 设置信息/策略 [@CarrierPartyID='Party_Carrier']/PolNumber = 'P123456'
  • 打印信息

XML:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.iwa.dtcc.com/" xmlns:ns="http://ACORD.org/Standards/Life/2">
    <soapenv:Header>
        <ser:MessageHeader>
            <MessageName>VI</MessageName>
            <RouteInfo>
                <FromParticipant>0057</FromParticipant>
                <ToParticipant>4516</ToParticipant>
                <Sender>0057</Sender>
                <TransmissionDate>2020-10-08</TransmissionDate>
                <TransmissionTime>13:32:35</TransmissionTime>
            </RouteInfo>
        </ser:MessageHeader>
    </soapenv:Header>
    <soapenv:Body>
        <ser:processValueInquiry xmlns="http://service.iwa.dtcc.com/">
            <VI_Msg xmlns="http://ACORD.org/Standards/Life/2">
                <TXLife xmlns="http://ACORD.org/Standards/Life/2" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <TXLifeRequest PrimaryObjectID="AnnuityOrder27995">
                        <TransRefGUID>SOAPUI-21207-2019030611</TransRefGUID>
                        <TransType tc="212">212</TransType>
                        <TransSubType tc="21207">21207</TransSubType>
                        <TransExeDate>2019-06-06</TransExeDate>
                        <TransExeTime>13:32:35</TransExeTime>
                        <PendingResponseOK tc="0">False</PendingResponseOK>
                        <OLifE>
                            <Holding id="AnnuityOrder27995">
                                <HoldingTypeCode tc="2">Policy</HoldingTypeCode>
                                <DistributorClientAcctNum>8888</DistributorClientAcctNum>
                                <Policy CarrierPartyID="Party_Carrier">
                                    <PolNumber>A235689</PolNumber>
                                    <CarrierCode>5544</CarrierCode>
                                    <CusipNum>5555</CusipNum>
                                </Policy>
                            </Holding>
                        </OLifE>
                    </TXLifeRequest>
                </TXLife>
            </VI_Msg>
        </ser:processValueInquiry>
    </soapenv:Body>
</soapenv:Envelope>

如何使 for 循环在特定值处停止

我正在创建一个 NBA 总决赛模拟器,它将预测 NBA 总决赛的获胜者和比赛的数量。这是我当前的代码:

def gamesSim(ns):
gamesout = []
team1win = 0
team2win = 0
tie = 0
for i in range(ns):
    gm = gameSim()
    gamesout.append(gm)
    if gm == 1:
        team1win +=1
    elif gm == -1:
        team2win +=1
    elif (team1win == 4 or team2win ==4)
    
    
   
    
print('Team1 Win', team1win/(team1win + team2win+tie), '%')
print('Team2 Win', team2win/(team1win + team2win+tie), '%')
print('Tie' , tie/(team1win + team2win + tie), '%')
return gamesout

这是它返回的内容:

Team1 Win 0.7142857142857143 %
Team2 Win 0.2857142857142857 %
Tie 0.0 %
[1, 1, 1, 1, 1, -1, -1]

问题是,我希望 for 循环在团队达到 4 胜时结束。我怎样才能做到这一点?

标签: karatefeature-file

解决方案


推荐阅读