I have the following list: rows= ['Azuay', '10,658', '195', '12', 'Bolívar', '2,111', '66', '12', 'Cañar', '2,110', '83', '7', 'Carchi', '3,053', '104', '1', 'Chimborazo', '2,516', '315', '119', 'Cotopaxi', '4,575', '281', '61', 'El Oro', '6,477', '466', '185', 'Esmeraldas', '4,271', '216', '51', 'Galápagos', '227', '1', '1', 'Guayas', '22,263', '1,737', '1,651', 'Imbabura', '4,773', '170', '7', 'Loja', '6,227', '222', '44', 'Los Ríos', '4,017', '342', '237', 'Manabí', '11,284', '1,025', '1,033', 'Morona Santiago', '3,008', '22', '0', 'Napo', '1,440', '74', '2', 'Orellana', '1,956', '53', '17', 'Pastaza', '2,258', '60', '15', 'Pichincha', '59,477', '1,789', '242', 'Santa Elena', '1,738', '368', '274', 'Santo Domingo de los Tsáchilas', '5,293', '361', '116', 'Sucumbíos', '2,763', '92', '2', 'Tungurahua', '5,119', '276', '223', 'Zamora Chinchipe', '1,580', '53', '1']  I want to convert it to :  [['Azuay', '10,658', '195', '12'],  ['Bolívar', '2,111', '66', '12'],  ['Cañar', '2,110', '83', '7'],  ['Carchi', '3,053', '104', '1'],  ['Chimborazo', '2,516', '315', '119'],  ['Cotopaxi', '4,575', '281', '61'],  ['Esmeraldas', '4,271', '216', '51'],  ['Galápagos', '227', '1', '1'],  ['Guayas', '22,263', '1,737', '1,651'],  ['Imbabura', '4,773', '170', '7'],  ['Loja', '6,227', '222', '44'],  ['Manabí', '11,284', '1,025', '1,033'],  ['Napo', '1,440', '74', '2'],  ['Orellana', '1,956', '53', '17'],  ['Pastaza', '2,258', '60', '15'],  ['Pichincha', '59,477', '1,789', '242'],  ['Sucumbíos', '2,763', '92', '2'],  ['Tungurahua', '5,119', '276', '223'],  ['Zamora Chinchipe', '1,580', '53', '1']]  I am using this code (check down below) to obtain this result; however, I want to optimize it. dict_kv=[] for i in range(0, len(rows)):   if (rows[i].strip().isalpha()):       dict_kv.append([rows[i],rows[i+1],rows[i+2],rows[i+3]])         dict_kv.append([rows[92],rows[93],rows[94],rows[95]])  s        pprint(dict_kv)
I have a list of arbitrary length, and I need to split it up into equal size chunks and operate on it. There are some obvious ways to do this, like keeping a counter and two lists, and when the second list fills up, add it to the first list and empty the second list for the next round of data, but this is potentially extremely expensive.  I was wondering if anyone had a good solution to this for lists of any length, e.g. using generators.  I was looking for something useful in itertools but I couldn't find anything obviously useful. Might've missed it, though.  Related question:
Customize newform save button - Save and redirect to another form What is the best way to add redirect function into the save button on a newform in SharePoint 2013.  When the user create a list item, he/she should be redirected to another form. Is it possible to get and parse the new generated item ID?  Start - Newform URL:   End - Editform URL:   Thanks Are the units of the quotient ring $\mathbb{F}_2[x]/\langle x^k+1 \rangle$ known in general, where $\mathbb{F}_2$ is the finite field with two elements? I'm specifically interested in the case where $k$ is divisible by two, such as say $k=8$, or $k=12$.  If so, can they be constructed easily? I'd be grateful if you could provide a few examples. How to download and use any other kernel than the one which is installed by default A scene I made is not rendering, at all. This grey screen stays the same and nothing changes.  Here are my settings:  [ The use of “So X as to be Y” First of all, note that this is not a duplicate question of another one asking about the usage of so as to, since this one is asking about the structure of so . . . as to. . . .  I understand this might have been a better question at the , since I’m not a native English speaker. I am asking it here since I want to get some professional advice in regard to this question, since I don’t seem to have found anything similar to this on the Internet.  At the Oxford Dictionaries Online (OD) I have found the following definition of ludicrous:     So foolish, unreasonable, or out of place as to be amusing.   I understand the phrase so as to, simply meaning in order to and preceding the purpose for which an action is done.  So by itself is just therefore, hence, thus, or a way of emphasizing an adjective or adverb.  As to in itself means with regard to or according to, as pointed out in .  In the OD definition of ludicrous, the use of so looks fair to me, that is, it clearly emphasizes the high extent to which something is foolish or unreasonable.  The use of as to doesn’t work in any way I’ve mentioned in this case (neither as in with regard to nor according to). I think the dictionary I’ve referred to has missed one, if not more, meaning of the phrase as to.  In this case, it appears to have likely been used as an alternative to that when used in the form So X, that Y, meaning something is or happens X (a combination of adjectives or adverbs) enough to cause Y to happen.  Of course, I don’t mean that in the structure so X as to Y the phrase as to is absolutely equivalent to that, since substituting as to with that changes the structure of Y.  Does all this mean that the phrase as to is a great alternative to that (although changing the structure of Y) whenever the sentence is of the form so X, that Y (where X is a combination of one or more adjectives or adverbs)?  I am new here and so I’m not too familiar with the variety of existing tags here, so if anyone sees an additional one that would fit, please add it to this question. I would also be glad to see some other corrections of my grammar. How to delete a non-empty directory in Terminal? How do I delete the following directory?  I typed:  rmdir lampp   This error comes up:  rmdir: failed to remove `lampp': Directory not empty   Is there a command to delete all the files in the directory and delete the directory folder? There is a problem with my logic and I cannot seem to point out where. There's a rocket ship travelling at close-to-c speed v without any acceleration (hypothetically), and there is an observer AA with a clock A on Earth, and there's another observer on the rocket BB with a clock B and these two clocks were initially in sync when the rocket was at rest with a FoR (frame of reference) attached to Earth. Now, this rocket's moving and AA tells us that B is running slower than A by a factor of$$ \gamma = 1 /(1-v^2/c^2)^{1/2} $$ $$ t_A/t_B = \gamma $$ where v is the relative 1d- velocity between the two i.e the earth and the rocket! That would mean the time elapsed on A is greater than that on B but this will happen only in the FoR of AA? So $t_B$ in this equation must be the time on B as observed by AA? Is this correct? What do the terms mean in the equations? If the symmetry holds and BB doesn't accelerate, then BB could say that $$ t_B/t_A = \gamma $$ right? where $t_B$ and $t_A$ are the times on B and A with respect to FoR of BB? But I was solving this problem and I took the earth FoR of A, but the prof took the rocket FoR of B? Like how will I know which FoR to solve the problem from? It'd greatly help if the terms in all the above equations were laid down neatly! DO we even need these FoRs?? Because in all the solved problems the prof is't specifying any and is using random ones! Please help!!!! This is the question where I messed up. The first rocket bound for Alpha Centauri leaves Earth at a velocity (3/5)c. To commemorate the ten year anniversary of the launch, the nations of Earth hold a grand celebration in which they shoot a powerful laser, shaped like a peace sign, toward the ship.  According to Earth clocks, how long after the launch (of the rocket) does the rocket crew first see the celebratory laser light?  This must be 25 years. My reasoning is: If v = 3c/5 10v + vt = ct where t is time taken by the light to reach the rocket from Earth as calculated from Earth.. and I solved that for t. and added 10 years to that because the time starts at the launch of the rocket!  According to clocks on the rocket, how long after the launch does the rocket crew first see the celebratory laser light?  This is 20 years. Here, I say: If it takes 25 years as observed by clocks on earth for the laser to reach the rocket, what should be the corresponding time as seen on a clock on the rocket? Using the formula: 25 = $\gamma$t where $\gamma$= 5/4 solved for t!  According to the rocket crew, how many years had elapsed on the rocket's clocks when the nations of Earth held the celebration? That is, based on the rocket crews' post-processing to determine when the events responsible for their observations took place, how many years have passed on the rocket's clocks when the nations of Earth hold the celebration?  For this, I did the following: 10 years on earth = T years on rocket ship where T must be lesser than 10 as observed from Earth FoR! Therefore, T= 4(10)/5 years = 8 years! But, prof says, 10 years on Earth = T years in rocket ship where T must be GREATER than 10 as observed from the rocket FoR??? Therefore, T = 10(5/4) years = 12.5 years!! What does this question actually want? Is Angular Momentum truly fundamental? This may seem like a slightly trite question, but it is one that has long intrigued me.  Since I formally learned classical (Newtonian) mechanics, it has often struck me that angular momentum (and generally rotational dynamics) can be fully derived from normal (linear) momentum and dynamics. Simply by considering circular motion of a point mass and introducing new quantities, it seems one can describe and explain angular momentum fully without any new postulates. In this sense, I am lead to believe only ordinary momentum and dynamics are fundamental to mechanics, with rotational stuff effectively being a corollary.  Then at a later point I learned quantum mechanics. Alright, so orbital angular momentum does not really disturb my picture of the origin/fundamentality, but when we consider the concept of spin, this introduces a problem in this proposed (philosophical) understanding. Spin is apparently intrinsic angular momentum; that is, it applies to a point particle. Something can possess angular momentum that is not actually moving/rotating - a concept that does not exist in classical mechanics! Does this imply that angular momentum is in fact a fundamental quantity, intrinsic to the universe in some sense?  It somewhat bothers me that that fundamental particles such as electrons and quarks can possess their own angular momentum (spin), when otherwise angular momentum/rotational dynamics would fall out quite naturally from normal (linear) mechanics. There are of course some fringe theories that propose that even these so-called fundamental particles are composite, but at the moment physicists widely accept the concept of intrinsic angular momentum. In any case, can this dilemma be resolved, or do we simply have to extend our framework of fundamental quantities? Finding volume of a segment Loopback to forwarded Public IP address from local network - Hairpin NAT How to know if my servers should use jumbo frames (MTU) How to make `sudo` preserve $PATH? I have a program that is installed in a custom directory under /opt. To make it easier to run it, I edited my bashrc to add said directory to my path: export PATH=$PATH:/opt/godi/bin:/opt/godi/sbin  This works fine if I want to run the program without sudo. However, if I try to run it with sudo it fails with a &quot;command not found&quot; error. $ sudo godi_console sudo: godi_console: command not found  Inspecting the PATH variable after using sudo reveals that its not including the same PATH I have as a normal user: $ sudo sh # echo $PATH                  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  Why is the PATH not the same? Am I doing something wrong? I'm on Debian Jessie, if it makes a difference. One thing I tried was to invoke /opt/godi/sbin/godi_console directly, passing the absolute path to the executable. Unfortunatelly, that didn't help in this particular case because godi_console itself depends on the PATH being correctly set. Congruent Modulo $n$: definition In an Introduction to Abstract Algebra by Thomas Whitelaw, he gives examples of the congruence mod operation, such as $13 \equiv5 \pmod4$,  and $9 \equiv -1 \pmod 5$. But when I first learned about the modulo operation my junior year, I would have told you that $13 \equiv 1 \pmod 4$, and that $9 \equiv 4 \pmod 5$.     Is this just a difference in the definition of modulo? Or is this pretty typical (to not take it to the largest factor, or one over)? Preventing applications from stealing focus System file windows open behind Unity launcher I'm on Ubuntu 16.04.1 at the moment, and system windows like the Files window, Terminal or System Software open behind the Unity launcher, which means they are partially hidden behind it. I can move them with Alt+F7, but I'd like a more permanent solution to this problem. I  and am I sometimes find myself writing something like this:     XXX is a project I admire and am very interested in.   The "I &#60;verb> and am &#60;something>" feels strange here. It somehow sounds more natural in the third person: "He admires and is very interested in...."  Am I just imagining things – is it OK to use this construction, or should I use something completely different? When to Garbage Collect "Didn't use to get" or "Didn't used to get"? I just made a minor , and  the grammar correction was unnecessary.  The original text was     Another factor--sometimes life happens and you can't fly. In the old days you could simply sell your ticket to someone else, now you either have to eat a hefty change fee or lose it outright. That's money in their pockets that they didn't used to get.   It was corrected to:     Another factor--sometimes life happens and you can't fly. In the old days you could simply sell your ticket to someone else, now you either have to eat a hefty change fee or lose it outright. That's money in their pockets that they didn't use to get.    Was this grammatical correction an improvement? Was the original text grammatically correct? Is the edited text grammatically correct? I need to set weights for some edges from a python script. I have tried looping through object.data.edges and setting bevel_weight values but I can't get it right. It only works if I have first edited some edge's bevel weight by hand from the 3d-view's transform window. But I would like to get it work from my script without any manual hacking.  Steps to reproduce:  Start Blender with default cube and switch to Scripting view.  Try to set weights for all edges:  for edge in C.object.data.edges:     edge.bevel_weight = 1.0   Verify that values changed:  for edge in C.object.data.edges:     edge.bevel_weight   Switch into edit mode in 3d-view and open up transform window by pressing n. Select edges to see that the change did not work (bevel weights are all zero). Switch back to object mode and read values again in scripting console to see that they were reset to zero:  for edge in C.object.data.edges:     edge.bevel_weight   Go back to edit mode and change some edge bevel weight straight from the transform window by hand. Go back to object mode and change values again from the scripting console:  for edge in C.object.data.edges:     edge.bevel_weight = 1.0   This time it works, bevel weights are 1.0 when you go back to edit mode and look from the transform window.   Any ideas? My final need is to apply a bevel modifier to only some set of edges and that's why I'm trying to mark them by using weights. Using vertex group for bevel modifier does not work in my situation, since I need to specify edges, not vertices, which to bevel.   I'm using Blender v2.71. Backtrack, Wi-Fi not working I've installed Backtrack 5R3 KDE, and I realized that my wireless is not working, but wired is working fine.  Here's the lshw output:     *-network         description: Ethernet interface         product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller         vendor: Realtek Semiconductor Co., Ltd.         physical id: 0         bus info: pci@0000:02:00.0         logical name: eth0         version: 05         serial: 04:7d:7b:b7:46:f8         size: 100MB/s         capacity: 100MB/s         width: 64 bits         clock: 33MHz         capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation         configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl_nic/rtl8105e-1.fw ip=192.168.2.2 latency=0 link=yes multicast=yes port=MII speed=100MB/s         resources: irq:42 ioport:2000(size=256) memory:f0404000-f0404fff memory:f0400000-f0403fff   lspci output:      00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09) 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 00:14.0 USB Controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation Panther Point MEI Controller #1 (rev 04) 00:1a.0 USB Controller: Intel Corporation Panther Point USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation Panther Point High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 1 (rev c4) 00:1c.1 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 2 (rev c4) 00:1d.0 USB Controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation Panther Point LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation Panther Point 6 port SATA AHCI Controller (rev 04) 00:1f.3 SMBus: Intel Corporation Panther Point SMBus Controller (rev 04) 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 05)