[Tutor] I am trying to print list elements but i am getting 'none'
Wayne Werner
waynejwerner at gmail.com
Mon Oct 10 16:14:01 CEST 2011
On Mon, Oct 10, 2011 at 8:26 AM, Praveen Singh <c2praveen30jun at gmail.com>wrote:
> print myList.append(numbers)
Your problem is with that statement.
>>> mylist = []
>>> x = mylist.append(3)
>>> x
>>> x is None
True
>>> help(mylist.append)
Help on built-in function append:
append(...)
L.append(object) -- append object to end
append returns None (all functions do, unless you explicitly return
something that is not None)
HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111010/7417d006/attachment.html>
More information about the Tutor
mailing list