Re: problem about list indexing

2006-11-26 Thread hollowspook
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 synta

Re: problem about list indexing

2006-11-26 Thread hollowspook
Thanks, John 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] "John Machin 写道: " > hollowspook wrote: > > Hi, there > > > > a = range(100) > > > > if I want to use No 7, 11,

problem about list indexing

2006-11-26 Thread hollowspook
Hi, there a = range(100) if I want to use No 7, 11, 56,90 in a, then the only way I do is [a[7], a[11], a[56], a[90]]. Is there any other way? Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with global variable in a module

2006-11-25 Thread hollowspook
Thanks for all the replys. "Diez B. Roggisch 写道: " > hollowspook schrieb: > > def aa(): > > global b > > b=b+1 > > print b > > > > b=1 > > aa() > > > > The above code runs well in python shell. > > &

problem with global variable in a module

2006-11-25 Thread hollowspook
def aa(): global b b=b+1 print b b=1 aa() The above code runs well in python shell. However I have a problem as follows. new a file named test.py def aa(): global b b=b+1 print b -