Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99414

if else python

From Scott Montreuil <scott@zml.ca>
Newsgroups comp.lang.python
Subject if else python
Date 2015-11-25 03:45 +0000
Message-ID <mailman.51.1448431821.20593.python-list@python.org> (permalink)

Show all headers | View raw


Hi,

I have an if statement which seems to run both commands and I cannot figure out why. (just learning so I may be missing something obvious) Any ideas?

while True:
        global latit,longt,jlatit,jlongt,mlongt,mlatit
        response = urllib.urlopen(url)
        data = json.loads(response.read())
        latit = data['Data'][0]['Latitude']
        longt = data['Data'][0]['Longitude']
        jlatit = data['Data'][1]['Latitude']
        jlongt = data['Data'][1]['Longitude']
        mlatit = data['Data'][2]['Latitude']
        mlongt = data['Data'][2]['Longitude']
        for i in user1locat:
                if float(i[2]) <= float(latit) <= float(i[3]) and float(i[4]) >= float(longt) >= float(i[5]):
                        newlocation = int(i[1])
                       screen.addstr(7, 40, "%s at %s" %(user1, i[0]))
                        motor1thread = threading.Thread(target=motor1)
                        motor1thread.start()
                        screen.refresh()
                else:
                        screen.addstr(5, 40, "%s is at an unknown location %f %f\n" % (user1, latit, longt))
                        newlocation = 200
                        motor1thread = threading.Thread(target=motor1)
                        motor1thread.start()
                        screen.refresh()
        time.sleep(10)

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

if else python Scott Montreuil <scott@zml.ca> - 2015-11-25 03:45 +0000
  Re: if else python Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-11-25 11:10 +0000
  Re: if else python John Gordon <gordon@panix.com> - 2015-11-26 13:25 +0000

csiph-web