0

My code:

i=[o for o in range(10000)]
ii=[o for o in range(10000,20000)]

for a,b in i,ii:
    print(a,b)

But the above code returns error (too many values to unpack)

I want to get the result as:

1 10001
2 10002
 ...........
10000 20000

I want to use this to create a download and upload parallel.

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Yashik011
  • 1
  • 1

1 Answers1

1

Use zip

i=[o for o in range(10000)]
ii=[o for o in range(10000,20000)]

for a,b in zip(i,ii):
    print(a,b)

Shorter

for a,b in zip(range(10000), range(10000,20000)):
    print(a,b)
Rakesh
  • 81,458
  • 17
  • 76
  • 113
  • For the lists you provided, I am not sure if you need two lists. Following generates only one array of numbers: `for a in range(10000): print(a,a+10000)` – Sheldore Jul 29 '18 at 23:18