Doubt

Sean DiZazzo half.italian at gmail.com
Wed Jul 23 15:22:42 EDT 2008


On Jul 23, 7:51 am, ജഗന്നാഥ് <jagana... at gmail.com> wrote:
> Friends
>
> I am a Perl programmer new to Python. I have a small doubt.
> How to convert the perl notation
> $a = ""; expression in Python ?
>
> How to represent the loop
> for ($a = $b; $a<=$c;$a++){
>
> } in Python
>
> Jagan
> Linguist

On most occasions you don't need to use the incrementing loop
behavior.  Lists are the main data structure comparable to an array,
and you can iterate over them without using a counter.  If you have:

aList = [1, 2, 3]

you can do

for item in aList:
    print item


Hope this helps.

~Sean



More information about the Python-list mailing list