» Home » lists » Page 1
NEsted Lists assign values directly (without .append), how to initialize and how to best organize such lists of lists
by Josh Freed in Programming Languages

Let me first elaborate a little on the background and then pose my question. I want to write a script to plot my data. It should search files I specify load the data from them, do some postprocessing like normalisation averaging and timestamp extraction, store them in an array or list of lists of some sort (or a database but im not too familiar with sqlite) and then plot data i specify.

Recursively remove spaces in a list (of lists of lists of lists…) in python
by JoeKaras in Coding

I'm trying to remove all of the spaces from elements in a list of lists (potentially of lists of lists etc. etc.)

The module I've written returns the first appearance of a base case alone instead of the whole recursed object, if that makes sense. Any idea what I've done wrong?

Many thanks!

def remove_spaces_from_list_recursive(the_list): #can deal with lis

How do I convert a nested tuple of tuples and lists to lists of lists in Python?
by AJacques in Programming Languages

I have a tuple containing lists and more tuples. I need to convert it to nested lists with the same structure. For example, I want to convert (1,2,[3,(4,5)]) to [1,2,[3,[4,5]]].

How do I do this (in Python)?

Assigning values to lists within lists within lists within lists
by Megatomic in Programming Languages

I have a hierarchy of lists within lists, and at the very bottom I'm assigning a decimal value. I need to assign this value based on the combination of the lists that are above it in the hierarchy. Each element of a particular list is an Enum value, so one combination could be Trees, Buildings, BuildingNumber. And another Trees, Buildings, BuildingPrice. What would be the best way of assign

Identifying lists that have 3 elements in common in a lists of lists
by Dirigible in Programming Languages


I have a list of lists. If there are subslists that have the first three elements in common , merge them into one list and add all the fourth elements.

The problem is best explained in code and the required output.

a_list = [['apple', 50, 60, 7],
['orange', 70, 50, 8],
['apple', 50, 60, 12]]
# output:
# [['apple',

How can I have a list of lists, with the top-level li's being inline, and the lower-level lists being normal lists?
by Stjepan in Web Design

Hey so I have a list, with some of the items containing other lists. The first level of lists needs to be inline, but any list a level down should be normal list-item. It works better if I show you. This is what I have:

However, I want Home Profile Groups Events and Frequencies to all be in one straight line, with any child lists below them. Here is the CSS:

#box1, #b

Pythonic way of summing lists and lists of lists
by deanschang in Development Tools & Services

I'm trying to find a neat way of summing a list and a list of lists in the same function, so far I've got:

import operator
Fails late for item = ['a', 'b']
def validate(item):
return sum(item) == sum(range(1, 10))
except TypeError:
return sum(reduce(operator.add, item)) == sum(range(1, 10))

How to find differences in lists in prolog and determine if the lists are the same (same elements but doesnt have to have the same order)
by crooter in Web Design

If i have two lists say A and B made upp of different letters. [b,a,c] in list A and [b,d,c,e] in list B
how can i get prolog to give me C,which is a list of elements that A has which are not included in list B
So if i type
I want the answer to read:

If i have two lists where

JQuery How to limit the number of items in sortable linked lists - connect lists
by ti22 in Development Tools & Services

I want to limit the number of images I can drag into each list. Each time the user will drag a clone into one of the connected lists. I need to limit the number of items they can drop into the sortable lists.

Do I need a custom Stop function? I tried that but it only limited the specific image rather than all of the images. What else can I do?

How can I do this?

Combining 2 lists like UNION ie keeping 1 copy of mutual items between 2 lists and appending others
by jihe in Programming Languages

I edited it. I made them lists to dictionaries. If a and b are 2 dictionaries:

a = {'UK':'http://www.uk.com', 'COM':['http://www.uk.com','http://www.michaeljackson.com']}
bb = {'Australia': 'http://www.australia.com', 'COM':['http://www.Australia.com', 'http://www.rafaelnadal.com','http://www.rogerfederer.com']}

I want to union them



Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .