I have 2 strings here:  line= ['ABDFDSFGSGA', '32\n'] line= ['NBMVA\n']   How do I remove \n from the end of these strings. I've tried rstrip() and strip() but I am still unable to remove the \n from the string. Can I have help removing it?
What is the Python equivalent of Perl's chomp function, which removes the last character of a string if it is a newline?
Convert object string to JSON Why do gases have weight? I know that a gas is made of atoms or molecules moving freely in space.  When these particles hit the walls of where they're kept in they cause something called pressure.  But these particles never pile up on each other and push a surface down by their weight so that we can measure it as weight, not pressure.  So why do gases have weight? By looking at this picture:    The earth is near the center of the universe. I've read that the universe look the same no matter where the observer is located. It is the same distance everywhere.  So I understand that for general relativity the universe need to be homogeneous and isotropic, so it will look the same no matter where I am.  But what if I'm on one of the planets near the right or left of the image, then if I draw the same picture of the universe, but from my perspective, then I would be also located in the center? If that's not the case (I'm actually near an edge), then part of my sky would be completely dark, and all the sky that way won't be isotropic? Linear regression with non-symmetric cost function? I want to predict some value $Y(x)$ and I am trying to get some prediction $\hat Y(x)$ that optimizes between being as low as possible, but still being larger than $Y(x)$. In other words: $$\text{cost}\left\{ Y(x) \gtrsim \hat Y(x) \right\}  &gt;&gt; \text{cost}\left\{ \hat Y(x) \gtrsim Y(x) \right\}  $$  I think a simple linear regression should do totally fine. So I somewhat know how to implement this manually, but I guess I'm not the first one with this kind of problem. Are there any packages/libraries (preferably python) out there doing what I want to do? What's the keyword I need to look for?  What if I knew a function $Y_0(x) &gt; 0$ where $Y(x) &gt; Y_0(x)$. What's the best way to implement these restrictions? What is the simplest way to prove the Earth is round? Assume you've come in contact with a tribe of people cut off from the rest of the world, or you've gone back in time several thousand years, or (more likely) you've got a numbskull cousin.  How would you prove that the Earth is, in fact, round? Number of pairs of strings satisfying the given condition We are provided with a string A (may contain repeated characters as well ). One needs to make all possible permutations of A , and find out how many pairs of strings chosen from these permutations are not similar.  Two strings are similar if we can make both of them exactly same by carrying out at most 1 swap in each of them .  Example :- if we are provided with string abcd  , then for permutation abcd , the permutations which are not similar to it are bcda , bdac , cadb , cdba , dabc , dcab . Similar is the case for other permuations as well. So overall number of desired pairs are 24*6=144 .  I tried solving it for each possible pair by approach mentioned here     But as the permutations can be large enough , I need a better approach of solving this. From the :  [1,4,9].map(Math.sqrt)   will yield:  [1,2,3]   Why then does this:  ['1','2','3'].map(parseInt)   yield this:  [1, NaN, NaN]   I have tested in Firefox 3.0.1 and Chrome 0.3 and just as a disclaimer, I know this is not cross-browser functionality (no IE).  I found out that the following will accomplish the desired effect. However, it still doesn’t explain the errant behavior of parseInt.  ['1','2','3'].map(function(i){return +i;}) // returns [1,2,3] I am from Europe, and I did an internship in the US (California) in 2015. When filing my 2015 taxes, I ended up having to pay some small difference for the federal taxes, but got a refund on my state taxes, of roughly $1.6k. That was all the income I had in the US in 2016.  I did not enter the US in 2016 at all.  I managed to figure out that I don't need to file any California tax forms for 2016 (source: ) but I am not sure about federal taxes.  I tried researching the problem, and got some information on it, but the situation is still a bit unclear. It seems that since I listed my state tax as an itemized deduction in my 2015 tax report, which I filed in 2016, the state refund I got in 2016 is, in fact, taxable.  In this situation, would I have to file my taxes (and possibly pay owed tax) for 2016, even though I never set foot in the US in that year, and my total income is just $1.6k? Proving $A+A'B=A+B$ without truth tables How can I prove the Boolean algebraic rule $$A+A'B=A+B$$ without using a truth table?  With the truth table, it is easy to see that the two are equal, but how can I prove it using lesser Boolean identities? Is it OK to require users to have a third party login account? What is the difference between an SLR and a DSLR? What are the differences between SLRs and DSLRs? (I know that DSLRs are Digital SLRs but are there any actual differences?)  Also, what are the advantages/disadvantages of both? Groups with Same Number Of Elements and Subgroups Has any Dark Force user/ally ever said "May the Force be with you"? C: pointer to struct in the struct definition How to split a large file into two parts, at a pattern?  Given an example file.txt:  ABC EFG XYZ HIJ KNL   I want to split this file at XYZ such that file1 contains lines up-to XYZ and rest of the lines in file2. Redshifting of Light and the expansion of the universe Can I use my Schengen visa for a completely different purpose and entry point? Is there a method to split thousands of polylines by employing a tool like the "Editor" - "Split" method and using distance, in ArcGIS?      When I utilize the "split" - "distance" tool (fig1), it only splits one section leaving the remainder unsplit (fig2).    I have attempted the "COGO" tool - using "Proportion", and can utilize the "duplicate" button to assign the remainder of segments which seems like a viable option.  But I would like to find some way to automate this process.  Has anyone found a method to do this?  Or is Python (coding) the only way?  I am trying to split over 2000 lines into equal distance segments (fig 3) of ~600m. Each segment will have its angle measured, and will ultimately result in a rose diagram representing angular statistics.  The distance of each segment is important in my splitting regime (a long line will have a greater representation of a particular angle on my rose diagram than the neighboring shorter line segments).  I currently am using ArcGIS 10.2 with an advanced user license. Troubleshoot High CPU usage by the "System" process I have noticed that from some time my system is freezing and its probably caused by the high CPU usage which is caused by the system process.  All applications I'm running is the Skype, TeamSpeak and Chrome so it definitely shouldnt eat that amount of CPU.  You can see the problem itself and running processes in the screenshot below:    Sometimes CPU usage is reaching 90%, but the average usage is like 40-65%.  My PC parameters:   Windows 8 (customer preview) Intel Core i3 - 2350M 8 GB RAM   I'd appreciate any help attempt! Regards.  --UPDATE--  As the user below posted a great answer, I have noticed that the process that is eating the most CPU in the system is called Arthurx.sys, simple google tells that it's a TPLink driver (an wifi adapter, I have bought like 2 weeks ago!) drivers has been installed from the Windows MSDN, but also tried to install the drivers from the attached CD, but it doesn't help. From the system start, it is using like 5% of the CPU only, but after 2-4 hours of working it is growing up and reaching 40-60% of the CPU usage.  Device name: TPLink WN722N In my class design, I use abstract classes and virtual functions extensively. I had a  feeling that virtual functions affects the performance. Is this true? But I think this performance difference is not noticeable and looks like I am doing premature optimization. Right?