python循环次数的使用

 

 

a=[str(i) for i in range(88888,88912)]
b=[str(i) for i in range(77777,77785)]

def f(a,b,k=0,m=0):
    n=0
    g = []
    while n<4:
        j = 0
        for i in a[k:]:
            while j < 1:
                g.append(i)
                k = k + 1
                j=j+1
                break
        j=0
        for i in b[m:]:
            while j < 2:
                g.append(i)
                m = m + 1
                j=j+1
                break
        j=0
        for i in a[k:]:
            while j < 5:
                g.append(i)
                k = k + 1
                j=j+1
                break
        n=n+1
    return g
if __name__=='__main__':
    g=f(a,b,0,0)
    print(g)

 

posted on 2018-12-13 16:43  一杯明月  阅读(3261)  评论(0编辑  收藏  举报