richard kappler
2015-09-16 17:03:04 UTC
Missing something obvious here, but down with the flu so I'm foggy and just
can't see it. I need to set a variable 'delay' to be used in
time.sleep(delay) later on in a script, based on user input. Something odd
is going on in setting the variable though. Here's the snippet where I'm
trying to set the variable:
#!/usr/bin/env python
delay = 7
print("1 - Batch")
print("2 - 2 per second")
print("3 - Real Time")
choice = raw_input("Enter feed speed choice (then press enter): ")
choice = int(choice)
if choice == 1:
print "running as batch"
delay == 0
elif choice == 2:
print "feeding 2 events per second"
delay == 0.5
elif choice == 3:
print "feeding real time"
delay = 'real time'
else:
print "choice not available"
os._exit(0)
print 'delay = ' + str(delay)
If I enter 1 or 2, I get delay = 7, if I enter 3, I get delay = real time.
HUH???
regards, Richard
can't see it. I need to set a variable 'delay' to be used in
time.sleep(delay) later on in a script, based on user input. Something odd
is going on in setting the variable though. Here's the snippet where I'm
trying to set the variable:
#!/usr/bin/env python
delay = 7
print("1 - Batch")
print("2 - 2 per second")
print("3 - Real Time")
choice = raw_input("Enter feed speed choice (then press enter): ")
choice = int(choice)
if choice == 1:
print "running as batch"
delay == 0
elif choice == 2:
print "feeding 2 events per second"
delay == 0.5
elif choice == 3:
print "feeding real time"
delay = 'real time'
else:
print "choice not available"
os._exit(0)
print 'delay = ' + str(delay)
If I enter 1 or 2, I get delay = 7, if I enter 3, I get delay = real time.
HUH???
regards, Richard
--
All internal models of the world are approximate. ~ Sebastian Thrun
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
All internal models of the world are approximate. ~ Sebastian Thrun
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor