Answers for "python is running both try and except statement"

0

python is running both try and except statement

elif 'where am i' in query or 'where we are' in query:
            speak("wait sir let me check")
            try:
                ipAdd = requests.get('https://ipinfo.io/').text
                print(ipAdd)
                data = ipAdd.json()
                #print(geo_data)
                city = data['city']
                # state = geo_data['state']
                country = data['country']
                speak(f'sir i m not sure but i think we are in {city} city of {country} country')
            except Exception as e:
                speak("sorry sir but due to network issues i m not able to found where we are")
                pass
Posted by: Guest on September-13-2021
0

python is running both try and except statement

elif 'where am i' in query or 'where we are' in query:
            speak("wait sir let me check")
            try:
                ipAdd = requests.get('https://ipinfo.io/').text
                print(ipAdd)
                data = ipAdd.json()
                #print(geo_data)
                city = data['city']
                # state = geo_data['state']
                country = data['country']
                speak(f'sir i m not sure but i think we are in {city} city of {country} country')
            except Exception as e:
                speak("sorry sir but due to network issues i m not able to found where we are")
                pass
Posted by: Guest on September-13-2021

Code answers related to "python is running both try and except statement"

Python Answers by Framework

Browse Popular Code Answers by Language