0

with open の (w) で予期しないインデントのエラーが発生します

    def run():
        """execute the TraCI control loop"""
        traci.init(PORT)#
        programPointer = len(PROGRAM)-1
        step = 0#
    with open("harsh1.txt","w") as harsh1:
        print >> harsh1, """hello"""
    while traci.simulation.getMinExpectedNumber() > 0:#
        traci.simulationStep()#
        programPointer = min(programPointer+1, len(PROGRAM)-1)
        no = traci.inductionloop.getLastStepVehicleNumber("0")#"0" is the detector id
        if no > 0:#
            programPointer = (0 if programPointer == len(PROGRAM)-1 else 3)
            traci.trafficlights.setRedYellowGreenState("0", PROGRAM[programPointer])#
        step += 1#
    traci.close()#
    sys.stdout.flush()#

微視的な交通シミュレーションに相撲シミュレーターを使用しています

4

1 に答える 1