writing code over several lines

anton muhin antonmuhin.REMOVE.ME.FOR.REAL.MAIL at rambler.ru
Fri Oct 17 10:05:56 EDT 2003


Dominik Kaspar wrote:
> i want to initialize a constant list at the beginning of a python
> program. but the list is too big for one line. is there any
> possibility to spread the list over several lines, so that the code
> looks neat again?
> 
> something like:
> LIST = [[100, 101, 102], [200, 201, 202], [300, 301, 302],
>         [400, 401, 402], [500, 501, 502], [600, 601, 602],
>         [700, 701, 702], [800, 801, 802], [900, 901, 902]]
> 
> thanks in advance
> dominik

:) yes. Just type the code and feed it to python interpreter:

LIST = [[100, 101, 102], [200, 201, 202], [300, 301, 302],
         [400, 401, 402], [500, 501, 502], [600, 601, 602],
         [700, 701, 702], [800, 801, 802], [900, 901, 902]]
print LIST

[[100, 101, 102], [200, 201, 202], [300, 301, 302], ...

regards,
anton.





More information about the Python-list mailing list