Home > Mobile >  Get list of numbers in python without using numpy
Get list of numbers in python without using numpy

Time:10-27

Is there a way to get list of numbers in python without using numpy. Example,

asd = ['926', '927', '928', '929', '930', '931']

I have a list above which are typed manually.. but can not put a range like (926 to 931) and get the list?

Any help?

CodePudding user response:

You can do with range map,

In [1]: list(map(str,range(926, 932)))
Out[1]: ['926', '927', '928', '929', '930', '931']

CodePudding user response:

asd = [str(i) for i in range(926, 932)]

  • Related