清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
def mrang(start,end=0,step=1): (start,end) = start>end and (end,start) or (start,end) #print (start,end) m = [] while start < end: m.append(start) start+=step return m print mrang(5),range(5) print mrang(1,5),range(1,5) print mrang(4,5,2),range(4,5,2) ''' [0, 1, 2, 3, 4] [0, 1, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] [4] [4] '''