I have this nested list:  summed = [[2, 3, 534, 56, 67, 676, 3423, 234, 34, 75], [546, 678, 23, 57, 7867, 54236, 325, 6546, 587, 114]]   I want to create a new nested list so that it will split the two previous lists into two more. The new list will look like:  new_list = [[[2, 3, 534, 56, 67], [676, 3423, 234, 34, 75]], [[546, 678, 23, 57, 7867, 54236, 325, 6546, 587, 114]]]. Every five numbers of each list will be a new list.   I want to create it with for or while loop. I have done this so far.  i = 0 while i&lt;len(summed):     new_list = []     j = 0     while (j&lt;len(summed[i])):         new_list.append(summed[i][j])         j+=5     new_list2.append(new_list)     i+=1 print new_list
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:
Can I connect to a specific access point by BSSID? Is there any way to get Mac OS X to connect to a specific access point by BSSID? I have a network with the same SSID for multiple access points, and I would sometimes like to specify which specific access point to connect to. Is this something Mac OS X can do natively, or is there a third party tool that can do this? Changing TTY keyboard layout on a server? I use 12.04 Server in command line mode (no X installed), and I would like to change the keyboard layout. How can I do this? I cannot boot to the desktop because I filled the file system. How do I reclaim some space? My memory is completely full when I tried following the data recovery and copied the wrong file using command line tool Test Disk. As it was taking so long to copy, I turned it off and I realized I copied the wrong file. Now my laptop memory is now full and lead me to more problems.  I have had similar problems to :       Now my screen keeps blinking:   Can anybody help? Many thanks. Wish you all the best. My problem is simple. I think that the strange deformations on the top are there because there are so many vertices in one face. How do I fix this while maintaining nice topology?  Although I triangulated the top polygon, the problem still persists. another topology multiple choice Let $S^1 = \{(x, y) \in \Bbb R^2 : x^2 + y^2 = 1 \}.$ Let $D = \{(x, y) \in\Bbb R^2 : x^2 + y^2 \le 1 \}$ and $E = \{(x, y) \in\Bbb R^2 : 2x^2 + 3y^2 \le 1\}$ be also considered as subspaces of $\Bbb R^2.$ Which of the following statements are true?  a. If $f : D \to S^1$ is a continuous mapping, then there exists $x \in S^1$ such that $f(x) = x$.  b. If $f : S^1 \to S^1$ is a continuous mapping, then there exists $x \in S^1$ such that $f(x) = x$.  c. If $f : E \to E$ is a continuous mapping, then there exists $x \in E$ such that $f(x) = x$. How Do Dementors Communicate with Wizards? How to delete files listed in a text file I have a text file that has a list of paths to various files. Is there a command I can use that will iterate through each line and delete the file at the stated path? How did Newton discover the universal law of gravitation? I am having trouble comprehending how anyone could come up with this formula:  $$F = \frac{GMm}{d^2}.$$   Could someone walk me through this? Proof of $\sin nx=2^{n-1}\prod_{k=0}^{n-1} \sin\left( x + \frac{k\pi}{n} \right)$ I have seen this identity on Wolfram mathworld and in a comment to another similar trigonometric proof:    I can't seem to find a proof to this identity online anywhere. What method is used to prove this? How to disable USB storage device support I want to disable a particular USB storage device (a sandisk flash drive). I read somewhere that you can use the .config file. How do i use it to disable that? Wrong posts number on Review section Lately it's happening to me this:  After completing one or more "First Posts" reviews, I go back to the Review Section main page:   And the post counter shows that there are still posts to review. I click the link to review them, but there is nothing.  Refreshing the page doesn't solve the issue: it shows the wrong number again. I've tried to read and understand this:   As a test, since my layout is "Polish, programmer" in the /usr/share/X11/xkb/symbols/pl file I played with remapping the 'q' character to 'x', and it worked just fine.  But what I want, is to remap LWIN (Left Super) to Left Control.   So I tried this: I started editing /usr/share/X11/xkb/symbols/pc file, assuming this is the 'root' of all the other files. Commented out this line:  //key &lt;LWIN&gt; {  [ Super_L       ]   };   and added this one:  key &lt;LWIN&gt; {    [ Control_L     ]   };   and rebooted PC, with no success. I.e. LWIN + C, doesn't copy selected text in text editors to clipboard, instead it just produces the 'c' letter. In the terminal instead of stopping current programm it also just produces the 'c' letter.  Here is my config file:   When I try the xev command and then press the Left Control Key, I see this:  KeyPress event, serial 40, synthetic NO, window 0x5a00001,     root 0x7e, subw 0x0, time 1053321, (374,-259), root:(374,545),     state 0x0, keycode 133 (keysym 0xffe3, Control_L), same_screen YES,     XKeysymToKeycode returns keycode: 37     XLookupString gives 0 bytes:      XmbLookupString gives 0 bytes:      XFilterEvent returns: False  KeyRelease event, serial 40, synthetic NO, window 0x5a00001,     root 0x7e, subw 0x0, time 1053425, (374,-259), root:(374,545),     state 0x0, keycode 133 (keysym 0xffe3, Control_L), same_screen YES,     XKeysymToKeycode returns keycode: 37     XLookupString gives 0 bytes:      XFilterEvent returns: False   BTW. Ask ubuntu suggests me two links to similar questions, but they are old, and suggest using xmodmap, and afaik it's no longer correct answer on Ubuntu >= 16.04 (Xenial) and this is precisely the version I have.  BTW2. I would really like to avoid using apps like Xbindkeys, considering there is a built in solution, which I guess I almost understand, and already spent some time on trying to understand it. Who paid for Harry's Nimbus 2000? The Nimbus 2000 was the fastest broom at the time of the Harry's first year at Hogwarts.  Professor McGonagall wanted to win the Quidditch Cup so she spoke with Dumbledore and got an exception from the rule that no first-years could have a broom for Harry.  My question is who paid for the broom?  It couldn't have been a cheap broom.  They wouldn't have taken gold out of Harry's Gringotts account without permission.  It wouldn't be right for the school to pay for it and I doubt McGonagall paid for it out of her own pocket.  So who paid for the broom? Just installed Ubuntu for the first time... Is there any simple way to browse installed programs?  On Mac there is the Applications top-level folder... here I see Desktop, Documents, Downloads etc but no Apps? That'd be a good idea, no? (is there some way to create this myself?)  On Windows there is the Start menu...  Here it seems like I have to click the 'Dash Home' and then I can see 'Recent Apps' ... I can search for them (I'd rather not)  ...or I can click the ruler/pencil icon at the bottom and see 'Recent Apps' and click to expand 'Installed Apps' ...ok that's all of them - is it possible to get a straight list view instead of the hard-to-scan wrapped rows?  Also, is there any way to get rid of the pointless random selection of 'Apps available for download' at the bottom? I'd like to find a Windows batch counterpart to Bash's $@ that holds a list of all arguments passed into a script.   Or I have to bother with shift? I haven't been able to find my favorite questions in the official Stack Exchange Android app.  Looking at my accounts page gives nothing on them. Newton's Law of Universal Gravitation tells us that the potential energy of object in a gravitational field is $$U ~=~ -\frac{GMm}{r}.\tag{1}$$  The experimentally verified near-Earth gravitational potential is  $$U ~=~ mgh.\tag{2}$$  The near-Earth potential should be an approximation for the general potential energy when $r\approx r_{\text{Earth}}$, but the problem I'm having is that they scale differently with distance.  $(1)$ scales as $\frac 1r$.  So the greater the distance from the Earth, the less potential energy an object should have.  But $(2)$ scales proportionally to distance.  So the greater the distance from the Earth, the more potential energy an object should have.  How is this reconcilable? Calculating $\int_{|z|=2}\frac{e^{1/z^2}}{1-z}dz$ Find the value of $\displaystyle\int_{|z|=2}\frac{e^{1/z^2}}{1-z}dz$   The first idea I had was to apply Cauchy's integral formula. But can this be done? $e^{1/z^2}$ is not holomorphic on the interior of $|z|=2$. Still, if we would apply this we would obtain:  $\displaystyle\int_{|z|=2}\frac{e^{1/z^2}}{1-z}dz=-2\pi ie$.  Another way I think, is to apply the residue theorem. For $1-z$ has a simple zero at $z=1$ and $e^{1/1^2}\neq 0$, then the residue of $e^{1/z^2}/(1-z)$ at $z=0$ is $-e$. Again we obtain $2\pi iRes(g;0)=-2\pi ie$, where $g=\frac{e^{1/z^2}}{1-z}$.  But again, it seems to me this is not right because $g$ has two singularities, at $z=1$ and $z=0$. What we might do about $z=0$? The answer is not $-2\pi i e$? Isomorphism involving Eilenberg-Maclane space, Tors. Let $\pi$ be a group and let $K(\pi, 1)$ be a connected CW complex such that $\pi_1(K(\pi, 1)) = \pi$ and $\pi_q(K(\pi, 1)) = 0$ for $q \neq 1$. Does there exist an isomorphism between $H_*(K(\pi, 1); A)$ and $\text{Tor}_*^{\mathbb{Z}[\pi]}(A, \mathbb{Z})$? Is there any way to tell the compiler, inside the main file body, how to find the class? I would like to use a class that belongs not found in my MiKTeX database. I know I might as well pick up this class and put it in some directory inside the base and update MiKTeX, but I do not want to do that. What I want is to organize it into a subdirectory within the same directory as my main tex file. However, when compiling the tex file, the class is not found. Of course, if I put the direct class in the same directory as the main file I will solve the problem, but that's not what I want. So, I ask: Is there any way to tell the compiler, inside the main file body, how to find the class?  Note: I'm using MiKTeX as an example, but I'm really having the problem in overleaf. There was a revtex upgrade from version 4.1 to 4.2. However, overleaf does not find revtex4-2.cls, which is, in fact, the class I'd like to use.  Below, I show an example of how I would like to organize the files. Note that the class is in a subdirectory.