-2

Hi I want to run make for loop to run infinitely.

for eg.

while True:

    try:
     script()

except Exception as e:
        script()
        continue

as below because in For loop I have lists where i want to apply on scripts which run in sequencing and continuous

while True:
    try:
        for symbol in symbol:
            script()

    except Exception as e:
        for symbol in symbol:
            script()
        continue
tdelaney
  • 73,364
  • 6
  • 83
  • 116

1 Answers1

0

I guess you are trying to run a program even when there is an exception and break at some condition, you do not want to run the loop infinitely I suppose. you can do

While true:
    try:
        for symbol in symbols:
            script(symbol) ' you should break however somewhere
    Exception as e:
        continue