Thanks, bearophile.
range(1, 8) + [10] is great!

"[EMAIL PROTECTED] 写道:
"
> hollowspook:
> > how about indexing 1-7, 10
> > [range(1:8),10] will generate [[1, 2, 3, 4, 5, 6, 7], 10], instead of
> > [1, 2, 3, 4, 5, 6, 7, 10]
>
> (Note that range(1:8) is a syntax error).
>
> You can join and extend lists as you like:
>
> >>> range(1, 8) + [10]
> [1, 2, 3, 4, 5, 6, 7, 10]
>
> See also the list.append and list.extend methods too.
> 
> Bye,
> bearophile

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to