Re: why for loop print only once after add if statement

2016-05-28 Thread meInvent bbird
when read my code again, i discover this error i fixed before but forget to do for another branch of if statement now fixed On Saturday, May 28, 2016 at 6:19:23 PM UTC+8, meInvent bbird wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item,

Re: why for loop print only once after add if statement

2016-05-28 Thread meInvent bbird
thanks, i discover that i misunderstand i and item, they should be swapped On Saturday, May 28, 2016 at 6:19:23 PM UTC+8, meInvent bbird wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item, i in enumerate(aa) > if item == findit: > p

Re: why for loop print only once after add if statement

2016-05-28 Thread Steven D'Aprano
On Sat, 28 May 2016 08:19 pm, jobmatt...@gmail.com wrote: > for item, i in enumerate(aa) > print item Wrong way around. It should be: for i, item in enumerate(aa): print item For example: py> for i, item in enumerate(aa): ... print i, item ... 0 c 1 h 2 e 3 e 4 s 5 e > this writing

Re: why for loop print only once after add if statement

2016-05-28 Thread Peter Otten
jobmatt...@gmail.com wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item, i in enumerate(aa) > if item == findit: > print item > > this only print the first value, means it only print once then not print > again, Assuming aa = ["fo

Re: why for loop print only once after add if statement

2016-05-28 Thread Sayth Renshaw
On Saturday, 28 May 2016 20:19:23 UTC+10, meInvent bbird wrote: > for item, i in enumerate(aa) > print item > > this writing, it can print all values > > for item, i in enumerate(aa) > if item == findit: > print item > > this only print the first value, means it only print once then not

why for loop print only once after add if statement

2016-05-28 Thread jobmattcon
for item, i in enumerate(aa) print item this writing, it can print all values for item, i in enumerate(aa) if item == findit: print item this only print the first value, means it only print once then not print again, where is wrong? -- https://mail.python.org/mailman/listinfo/python-l