>>> import datetime
>>> now = datetime.datetime.now()
>>> now
datetime.datetime(2017, 4, 11, 11, 40, 51, 361335)
>>> now.isoformat()
'2017-04-11T11:40:51.361335'
>>> import urllib
>>> urllib.urlencode({'start_gte': now.isoformat()})
'start_gte=2017-04-11T11%3A40%3A51.361335'
import decimal
def drange(x, y, jump):
while x < y:
yield float(x)
x += decimal.Decimal(jump)
heights = range(126, 200 + 1, 1)
for height in heights:
weights = drange(30, 140 + 0.5, 0.5)
for weight in weights:
print(height, '-', weight)
import random
random.seed()
MAXINT = 100
def get_even_rand():
x = random.randint(0, MAXINT//2)
yield x*2
>>> print get_even_rand().next()
56
>>> print get_even_rand().next()
62
>>> print get_even_rand().next()
94
>>> print get_even_rand().next()
90
>>> print get_even_rand().next()
16