On Mon, 20 Oct 2014 22:40:50 +0000 (UTC), Denis McMahon
<denismfmcma...@gmail.com> wrote:

>On Mon, 20 Oct 2014 15:49:15 -0400, Seymore4Head wrote:
>
>> For starters I would like to know if you can make a single item list and
>> then turn it into a 2 item list.  Is there a command for that?
>
>Yes, it's called assignment. You can for example change a member of a 
>list from an string to a tuple such as ( string, number ):
>
>>>> x = [ "fred", "jim", "susan" ]
>>>> x[x.index("jim")] = ( "jim", 11, )
>>>> print x
>['fred', ('jim', 11), 'susan']
>
>> Do you have to know the number of items the list will have before making
>> it?
>
>No. See the append() method of the list object.

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

Reply via email to