0

I'm working on a Python script that scrapes a website based on user input. For practice, I'm using a sample website from which I am scraping data. The issue I have is in my use of the wait(10) method. The code reads as follows:

from os import wait
from lxml import html, etree
import requests

def select_PA_city(self):
    pa_city_list = ["Philadelphia", "Pittsburgh", "Harrisburg", "Erie", "Scranton", "Allentown"]
    print("The major cities in Pennsylvania are Philadelphia, Pittsburgh, Harrisburg,"
          "Erie, Scranton, and Allentown.")
    city_found = False
    while not city_found:
        pa_city = input("Select a Pennsylvania city from this list:")
        for city in pa_city_list:
            if pa_city == city:
                print("You selected " + pa_city)
                city_found = True
            else:
                pass
        if city_found:
            print("That city is one of the top 6 listed.")
        else:
            print("That city (" + pa_city + "} is not in the top 6.  Please try again.")
            os.system.wait(10)
    return pa_city

Now I'm using PyCharm community as my Python IDE and the first import statement is not being recognized. I checked the os.py module in my c:\Python38\Lib\ directory, and cannot find the wait method in there. How do I locate the actual wait() method definition in another Python module, or is there another Python module that contains the wait() method? If not, what alternate method should I use for initiating a 10-second delay?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
John B.
  • 11
  • 3

0 Answers0