My question seems simple, but for a novice like a dragon like me it seems to be very complicated for me, So here's the situation:
I need to get a list:
l = [(A, B, C), (D, E, D), ( Etc., etc., etc., (etc, etc., etc.)] and make each index a personal list so that I can pull elements of each index in particular. The problem is that the list in which I'm actually working has hundreds of indexes such as above and I can not do anything like this:
L_new = list (L '' specific index Insert here ']) for each This means that the memory list will be filled with hundreds of lists near the different indexes of the first list and more time than my point view Memory will be used. So my question is, how can I separate these indices and then pull different parts from them without the need to create hundreds of individual lists (at least to that point where I need hundreds of individual lines Does not happen).
I can say your question wrong, but I want to say that you actually have something Also do not need to be able to pinpoint your tuples, see my comment, but: l [0] [0] will give "a" , L [0] [1] will give "b" , l [2] [1] gives "etc" etc. ... If you really want to enter
cast = [entry] [entry]] If you want to reach all the dimensions then I would recommend the list easier. Specifically for your comment: crosscut = [entry to entry] [0] In response to comment 2: A part of up to a very useful operation called the slicing action can be done specifically to perform the task that is referred to:
multiple_index = [entry [0: 3] ] For entry in L] Depending on your readability, in fact many priorities Are:
list_of_lists = [] For the sublist in L: list_of_lists.append (list (sublist)) iterator = iter (L) in the range I (0, Iterator .__ Length_Hent__ ( ): Return list (iterator.next ()) # or yield list (iterator.next ()) If you want to evaluate sluggish
No comments:
Post a Comment