List

Gold Fish occeanlinux at linuxmail.org
Sun Jun 2 17:43:20 EDT 2002


Charl P. Botha wrote:

> In article <3cfa7619_1 at news.iprimus.com.au>, Gold Fish wrote:
>> Charl P. Botha wrote:
>> 
>>> In article <3cfa6ed8_1 at news.iprimus.com.au>, Gold Fish wrote:
>>>> Assume we got 2 list
>>>> list 1 = ['ABC','CDG','DAV','FE','FECA','FEAFA','FEA']
>>>> list 2 = []
>>>> how can we copy element from list 1 to list 2 say i just want to copy
>>>> the 3 element 'CDG','DAV','FE' to list2 only.
>>> 
>>> list1 = ['ABC','CDG','DAV','FE','FECA','FEAFA','FEA']
>>> list2 = list1[1:4]
>>> 
>>> Is that what you meant?
>>> 
>> No i mean if i got from list1 i wanna take 3 elements in any position to
>> list2 but i don't know how many item in that list.
> 
> Could you rephrase that?  The example I posted does exactly what your
> example showed.  Maybe if you gave another example and tried to explain
> more clearly, I'd know what you were trying to do.
> 
What i am trying to do is that i got one biglist don't know how big is it 
say list1 then i like to divided into some small sublists. These sublists 
will have some elements in the biglist for example 3 elements maximum in 
each sublist. So if the biglist got 10 elements then it'll be divided into 
4 sublists the first 3 will have 3 elements and the last one will have one 
elements.



More information about the Python-list mailing list