» Home » lists » Page 1
NEsted Lists assign values directly (without .append), how to initialize and how to best organize such lists of lists
Category : 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.



View Replies


Recursively remove spaces in a list (of lists of lists of lists…) in python
Category : 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

View Replies


How do I convert a nested tuple of tuples and lists to lists of lists in Python?
Category : 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)?


View Replies


Assigning values to lists within lists within lists within lists
Category : 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


View Replies


Identifying lists that have 3 elements in common in a lists of lists
Category : 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',

View Replies


How can I have a list of lists, with the top-level li's being inline, and the lower-level lists being normal lists?
Category : 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

View Replies


Pythonic way of summing lists and lists of lists
Category : 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))
"""<

View Replies


JQuery How to limit the number of items in sortable linked lists - connect lists
Category : 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?


View Replies


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)
Category : 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
Ex.
So if i type
difference([b,a,c],[b,d,c,e],C).
I want the answer to read:
C=[a]


If i have two lists where


View Replies


Combining 2 lists like UNION ie keeping 1 copy of mutual items between 2 lists and appending others
Category : 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


{'Aust

View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .