数字が単調に増加する順序で整数1
を書き込むPythonicで効率的な方法は何ですか?10**6
例えば:
(1,2,3,4,5,6,7,8,9,10,11,20,21,22,30,31,32,33,...)
これで仕事は完了しますが、見た目はかなり醜いです。
nums = [10**0*k6 for k6 in range(1,10)] +
[10**1*k5 + 10**0*k6 for k5 in range(1,10) for k6 in range(k5+1)] +
[10**2*k4 + 10**1*k5 + 10**0*k6
for k4 in range(1,10) for k5 in range(k4+1) for k6 in range(k5+1)] +
[10**3*k3 + 10**2*k4 + 10**1*k5 + 10**0*k6
for k3 in range(1,10) for k4 in range(k3+1) for k5 in range(k4+1) for k6 in range(k5+1)] +
[10**4*k2 + 10**3*k3 + 10**2*k4 + 10**1*k5 + 10**0*k6
for k2 in range(1,10) for k3 in range(k2+1) for k4 in range(k3+1) for k5 in range(k4+1) for k6 in range(k5+1)] +
[10**5*k1 + 10**4*k2 + 10**3*k3 + 10**2*k4 + 10**1*k5 + 10**0*k6
for k1 in range(1,10) for k2 in range(k1+1) for k3 in range(k2+1) for k4 in range(k3+1) for k5 in range(k4+1) for k6 in range(k5+1)]