Re: [Tutor] Lists

2011-06-10 Thread eizetov
Vincent, you should also try to avoid naming your lists a 'list'. There's a couple dozen words in Python that are reserved 'for system use': import keyword print(keyword.kwlist) ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'exce

[Tutor] String formatting question with 's'.format()

2011-06-08 Thread eizetov
I'm working through the 'Learn Python' book by Mark Lutz, in this example: somelist = list('SPAM') parts = somelist[0], somelist[-1], somelist[1:3] 'first={0}, last={1}, middle={2}'.format(*parts) "first=S, last=M, middle=['P', 'A']" why do we need the '*' at 'parts'. I know we need it, becaus