> On 5/17/18 11:57 AM, Abdur-Rahmaan Janhangeer wrote:
> > x = [0,1]
> > x.remove(0)
> > new_list = x
> >
> > instead i want in one go
> >
> > x = [0,1]
> > new_list = x.remove(0) # here a way for it to return the modified list by
> > adding a .return() maybe ?
> 
> There isn't a way to do that in one line.

   new_list = list(x.remove(0))
   new_list = x.remove(0)[:]

?

No one said x can't be modified, only that new_list is
to contain the modified list after one line of code :)

kh
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to