mxrange 模拟 系统 xrange

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

def mxrange(start,end=0,step=1):
    (start,end) = start>end and (end,start) or (start,end)
    while start < end:
        yield start
        start+=step      
        
        
print [i for i in xrange(5)],[i for i in mxrange(5)]
print [i for i in xrange(1,5)],[i for i in mxrange(1,5)]
print [i for i in xrange(4,5,2)],[i for i in mxrange(4,5,2)]
'''
[0, 1, 2, 3, 4] [0, 1, 2, 3, 4]
[1, 2, 3, 4] [1, 2, 3, 4]
[4] [4]
'''