I have input consisting of a list of nested lists like this:
l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]]
I want to sort this list based on the sum of all the numbers in the nested lists... so, the values I want to sort by of l would look like this:
[39, 6, 13, 50]
Then I want to sort based on these. So the...
I have the following code which I use to map a nested list in Python to produce a list with the same structure.
>>> nested_list = [['Hello', 'World'], ['Goodbye', 'World']]
>>> [map(str.upper, x) for x in nested_list]
[['HELLO', 'WORLD'], ['GOODBYE', 'WORLD']]
Can this be done with list comprehension alone (without using the map func...
Hello,
I am building an Accordion Menu using jQuery UI. But it appears to me that the navigation: true setter does not work for a nested <ul> tag.
navigation: true works for Header A -> Link 1, Header B -> Link 2, but not for anything in subHeader under Header B (Link 3, Link 4).
May I know if I am using an incorrect structure so that ...
Question: What would be the most effective way of doing a nested list which allows for data binding in the view and awareness of what shipment is selected so that command bindings from the view can function in the viewmodel on the appropriate item in any of the nested lists?
Info:
I've got a program that I've been working a lot on to...
Ok I have a class similar to the following...
public class Order
{
private Guid id;
[DataMember]
public Guid ID
{
get { return id; }
set { id = value; }
}
private List<Items> orderItems;
[DataMember]
public List<Items> OrderItems
{
get { return orderItems; }
set { orde...
Hi there.
I wonder if you can help me. I am looking to implement multi level navigation, parent section, child, grand child, etc which in cakePHP is straight forward enough using the tree data structure.
However, in terms of the front end, I don't want to just output all pages in the structure. I want to only output the structure of th...
I have a fairly large, three level deep, menu consisting of nested lists like in this example
<ul class="nav">
<li><a href="#">1</a>
<ul>
<li><a href="#">2</a>
<ul>
<li><a href="#">level 3</a></li>
<li><a href="#">level 3</a></li>
<li><a href="#">level 3</a></li>
</ul>
</li>
...
Say I have a string representing some nested lists and I want to convert it into the real thing. I could do this, I think:
exec "myList = ['foo', ['cat', ['ant', 'bee'], 'dog'], 'bar', 'baz']"
But in an environment where users might be supplying the string to execute this could/would be a bad idea. Does anybody have any ideas for a ti...
Why do these two operations give different results?
>>> c = [1, 2, 3]
>>> c
[1, 2, 3]
>>> c += c
>>> c
[1, 2, 3, 1, 2, 3]
>>> c = [1, 2, 3]
>>> c.append(c)
>>> c
[1, 2, 3, [...]]
>>>
In the last case there's actually infinite recursion. c[-1] and c are the same. Why is it different with the + operation?
...
I know you can create easily nested lists in python like this:
[[1,2],[3,4]]
But how to create a 3x3x3 matrix of zeroes?
[[[0] * 3 for i in range(0, 3)] for j in range (0,3)]
or
[[[0]*3]*3]*3
Doesn't seem right. There is no way to create it just passing a list of dimensions to a method? Ex:
CreateArray([3,3,3])
...
Hey guys,
I've got a a left floated UL list for a menu, one option with a nested UL for dropdown, each of which is given it's own nested ul child, which is only displayed on hover. What I'm finding in IE 7 is that if the mouse moves out of the boundries of the parent then the sub-menu disappers, it also seems to be clearing out the link...
Hi all,
I need to implement a structure similar to this: example.com/folder1/folder2/folder3/../view (there can be other things at the end instead of "view")
The depth of this structure is not known, and there can be a folder buried deep inside the tree. It is essential to get this exact URL pattern, i.e. I cannot just go for example.c...
Hi
I have a nested oredered list which i m animating using this code...
var $li = $("ol#update li");
function animate_li(){
$li.filter(':first')
.animate({
height: 'show',
opacity: 'show'
}, 50...
i have this code
$(document).ready(function() {
$("#test-list").sortable({
items: "> li",
handle : '.handle',
axis: 'y',
opacity: 0.6,
update : function () {
var order = $('#test-list').sortable('serialize');
$("#info").load("process-sortable.asp?"+order+"&id=catid&orde...
$(document).ready(function() {
$("#test-list").sortable({
items: "> li",
handle : '.handle',
axis: 'y',
opacity: 0.6,
update : function () {
var order = $('#test-list').sortable('serialize');
$("#info").load("process-sortable.asp?"+order+"&id=catid&order=order...
Hi
I m having a ordered list having the structure
<ol>
<li>
</li>
<li>
</li>
<li>
<ol>
<li>
Test
</li>
<li>
another test
</li>
<li>
<a href='#'>Add </a>
</li>
...
I need to be able to display and edit a hierarchical list of tasks in a C# app. It can either be a Windows form app, or ASP.NET.
Basically, I want similar behaviour to the way Microsoft Project handles tasks.
The control would need to:
1) Maintain a list of items made up of several fields
2) Each item can have a number of children (a...
I'm trying to be a good erlanger and avoid "++". I need to add a tuple to the end of a list without creating a nested list (and hopefully without having to build it backwards and reverse it). Given tuple T and lists L0 and L1:
When I use [T|L0] I get [tuple,list0].
But when I use [L0|T], I get nested list [[list0]|tuple]. Similarly, [L...
Hi,
is it possible to define a LINQ statement for the following problems WITHOUT using a foreach loop?
public class GroupObject
{
public String name;
public List<String> letters;
public void test()
{
List<GroupObject> myGroups = new List<GroupObject> {
new GroupObject {
name="test1",
...
First-timer here, I hope I explain this well enough...
PHP/Smarty, I'm working on a section of a page that displays bullet lists of notes associated with either the general page, or individual places on that page. Some places don't have notes. Something like:
General
note 1
New York
note 2
note 3
Boston
note 4
I have two a...