About python while statement and pop()

Dave Angel davea at davea.name
Wed Jun 11 23:34:43 EDT 2014


hito koto <hitokoto2014 at gmail.com> Wrote in message:
> Hello,all
> I'm first time,
> 
> I want to make a while statement which can function the same x.pop () and without the use of pop、how can i to do?

No idea what the question means. Are you just trying to rewrite
 the loop in a python implementation where pop is broken?
 


> 
> i want to change this is code:
> 
> def foo(x):
>     y = []
>     while x !=[]:
>         y.append(x.pop())
>     return y

Perhaps you're looking for the extend method. 

-- 
DaveA




More information about the Python-list mailing list