Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Default Variable in for loop

I am wondering if Python has the concept of storing data in the default variable in for loop.

For example, in perl, the equivalent is as follow

foreach (@some_array) {
    print $_
}

Thanks, Derek

like image 841
defoo Avatar asked Dec 03 '22 03:12

defoo


1 Answers

No. You should just use

for each in some_array:
    print each
like image 134
dave Avatar answered Dec 27 '22 04:12

dave