» 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

Hi


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):
try:
return sum(item) == sum(range(1, 10))
except TypeError:
return sum(reduce(operator.add, item)) == sum(range(1, 10))
"""<

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?


How do I loop through two lists of lists and avoid duplicate combinations for values at specific positions?
by neosephiroth86 in Programming Languages

I would like to loop through two lists of lists and avoid duplicate combinations of values between positions 1 and 2 of each list.


a = [[2007, 206, 205, 8], [2007, 206, 208, 9]]
b = [[2007, 205, 206, 8], [2007, 207, 210, 10]]

In this case for a[0], positions 1 and 2 would be 206 and 205 respectively, and for b[0], positions 1 and 2 would be 205 and 206.


Is there a typical name for a function like 'map' that operates on a list of argument lists instead of multiple lists of arguments?
by odunthorne in Development Tools & Services

(I finally posted and accepted an answer to the effect of "no, there isn't, and the question isn't actually that general".)


Consider the Common Lisp function 'mapcar'. It takes a function and some lists as arguments, and calls the function with arguments pulled from the same position in each list.


Do standard libraries typically have a similar function that takes a singl


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