Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (47.6k points)

I have a python program that navigates me to a website with a function that I have defined as nav(a,b), and on this site, I will be downloading some pyfits data for use on another script. This site has a different pyfits file for every set of (a,b) in a catalog I have.

I was wondering if I could iterate through this catalog using a for loop, and each time the nav(a,b) function is used, tell python to pause while I download the file, then resume again when I tell it to. I've done something like this in idl before, but don't know how with python.

Otherwise, I guess I'm stuck running the program 200 times, replacing the (a,b) values each time, which will take forever.

1 Answer

0 votes
by (106k points)

For, pausing a for loop in Python, if you want to wait for a manual signal to continue, wait for the user to press Enter:

Python 2:

raw_input("Press Enter to continue...")

Python 3:

input("Press Enter to continue...")

To know more about this you can have a look at the following video tutorial:-

Browse Categories