I am relatively new to Python, is there a way I can split the string "James kicked Bob's ball, laughed and ran away." into the following, so I have the words and punctuation in list items ["James", "kicked", "Bob's", "ball", ",", "laughed", "and", "ran", "away", "."]. is there a way to do this in python?
I'm trying to split a string up into words and punctuation, adding the punctuation to the list produced by the split.  For instance:  &gt;&gt;&gt; c = "help, me" &gt;&gt;&gt; print c.split() ['help,', 'me']   What I really want the list to look like is:  ['help', ',', 'me']   So, I want the string split at whitespace with the punctuation split from the words.  I've tried to parse the string first and then run the split:  &gt;&gt;&gt; for character in c: ...     if character in ".,;!?": ...             outputCharacter = " %s" % character ...     else: ...             outputCharacter = character ...     separatedPunctuation += outputCharacter &gt;&gt;&gt; print separatedPunctuation help , me &gt;&gt;&gt; print separatedPunctuation.split() ['help', ',', 'me']   This produces the result I want, but is painfully slow on large files.  Is there a way to do this more efficiently?
Enable Careers and Jobs in app Please provide the Careers and Jobs features in the app. This will help us to closely interact with employers. It will be an additional advantage if you provide chat option with employers too.  We, as job seeker, would like to see ratings and feedback of previous employees too for that company, before making a decision of job change. What is the exact reason that normal matter can not exist within an event horizon?  I can understand how a super-dense object like a neutron star could accrete mass until its physical radius is less than its Schwarzschild radius and an event horizon forms around it.   But why can't the neutron star remain inside the event horizon as it was before the event horizon formed? Aside from the escape velocity at the surface reaching $c$, what actually changed?  Why must all matter within an event horizon undergo complete physical collapse to a point? Is there a single word for "one who speaks/boasts a lot about everything"? I'm looking for a single word to most aptly describe a person possessing the following "qualities":   Appears to be superior in every technology/skill under the sun, which he deems worthy of knowing On being questioned/assigned the task, is found to have only superficial/no knowledge of the said skill. Inherent tendency to "one-up" anyone and everyone - example: "I didn't work hard at all in my undergrad days, but yet I have better/equal grades than you have! "   Could someone help?  Edit: I've got some very good responses, but despite popular opinion for "braggart", I'm going with "pretentious" as it suits what I was looking for more aptly IMHO. Set value of textarea in jQuery I am attempting to set a value in a textarea field using jquery with the following code:  $("textarea#ExampleMessage").attr("value", result.exampleMessage);   The issue is, once this code executes, it is not altering the text in the textarea?  However when performing an alert($("textarea#ExampleMessage").attr("value")) the newly set value is returned? How to move 100 files from a folder containing thousands? I have a directory with thousands of files. How can I move 100 of the files (any files will do) to another location. I have always wondered why diamonds shine. Can anyone tell me why? Is there a size of rectangle that retains its ratio when it's folded in half? A hypothetical (and maybe practical) question has been nagging at me.  If you had a piece of paper with dimensions 4 and 3 (4:3), folding it in half along the long side (once) would result in 2 inches and 3 inches (2:3), which wouldn't retain its ratio. For example, here is a piece of paper that doesn't retain its ratio when folded:   Is retaining the ratio technically possible? If so, what is the side length and ratio that fulfills this requirement? Any help would be appreciated.  Update:  I added "once" because I got an answer saying that any recectangle would work, as any rectangle folded twice has the original ratio. Nice answer, but not quite what I was looking for. As for the other answers, I got 3x as much information as I needed! Thanks! Sometimes I hear people say something like the example below. Is it correct to use the word since in this manner?     Mosquitoes are surviving on earth since millions of years. Join CSV file to shapefile I wanted to join a CSV file to a shapefile.  When I identified a field to facilitate the join, e.g.,   map &lt;- spChFIDs(map, as.character(map$ID))   it returned     Error in spChFIDs(SP, x) : lengths differ   Can anyone advise? How can I get a significant overall ANOVA but no significant pairwise differences with Tukey's procedure? I performed with R an ANOVA and I got significant differences. However when checking which pairs were significantly different using the Tukey's procedure I did not get any of them. How can this be possible?  Here is the code:  fit5_snow&lt;- lm(Response ~ Stimulus, data=audio_snow) anova(fit5_snow)  &gt; anova(fit5_snow) Analysis of Variance Table  Response: Response           Df Sum Sq Mean Sq F value  Pr(&gt;F)   Stimulus   5  73.79 14.7578  2.6308 0.02929 * Residuals 84 471.20  5.6095                   --- Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1   df&lt;-df.residual(fit5_snow) MSerror&lt;-deviance(fit5_snow)/df  comparison &lt;-  HSD.test(audio_snow$Response, audio_snow$Stimulus, df, MSerror, group=FALSE)  &gt; comparison &lt;-  HSD.test(audio_snow$Response, audio_snow$Stimulus, df, MSerror, group=FALSE)  Study:  HSD Test for audio_snow$Response   Mean Square Error:  5.609524   audio_snow$Stimulus,  means                  audio_snow.Response   std.err replication snow_dry_leaves            4.933333 0.6208034          15 snow_gravel                6.866667 0.5679258          15 snow_metal                 6.333333 0.5662463          15 snow_sand                  6.733333 0.5114561          15 snow_snow                  7.333333 0.5989409          15 snow_wood                  5.066667 0.7713110          15  alpha: 0.05 ; Df Error: 84  Critical Value of Studentized Range: 4.124617   Comparison between treatments means                                Difference   pvalue sig        LCL      UCL snow_gravel - snow_dry_leaves  1.9333333 0.232848     -0.5889913 4.455658 snow_metal - snow_dry_leaves   1.4000000 0.588616     -1.1223246 3.922325 snow_sand - snow_dry_leaves    1.8000000 0.307012     -0.7223246 4.322325 snow_snow - snow_dry_leaves    2.4000000 0.071587   . -0.1223246 4.922325 snow_wood - snow_dry_leaves    0.1333333 0.999987     -2.3889913 2.655658 snow_gravel - snow_metal       0.5333333 0.989528     -1.9889913 3.055658 snow_gravel - snow_sand        0.1333333 0.999987     -2.3889913 2.655658 snow_snow - snow_gravel        0.4666667 0.994348     -2.0556579 2.988991 snow_gravel - snow_wood        1.8000000 0.307012     -0.7223246 4.322325 snow_sand - snow_metal         0.4000000 0.997266     -2.1223246 2.922325 snow_snow - snow_metal         1.0000000 0.855987     -1.5223246 3.522325 snow_metal - snow_wood         1.2666667 0.687424     -1.2556579 3.788991 snow_snow - snow_sand          0.6000000 0.982179     -1.9223246 3.122325 snow_sand - snow_wood          1.6666667 0.393171     -0.8556579 4.188991 snow_snow - snow_wood          2.2666667 0.103505     -0.2556579 4.788991 How can I buy apps in the App Store without a credit card? Draft mode for pgfplots I'm working on a fairly big document that has a lot of graphs of functions- so far it has around 200, by the end it will have around 1500. I use pgfplots for each graphic, and the functions are pretty basic: exponential, rational, polynomial, and trigonometric.  Once I am happy with each graph, I don't necessarily need to see it every time I compile, and would like to minimize compilation time for future drafts. Naturally, the document is already chopped up into chapter files, but each chapter contains around 100 figures.  Having studied the pgfplots documentation, I haven't found a draft mode, but I'm interested in knowing if one could be created.    I'm envisaging something similar to the draft mode of the graphicx package, in which graphics are not included, and blank boxes are put in their place.  Some things I've considered:   the  documentclass; but with about 1500 figures, wouldn't this mean over-modulization?  tikzexternalize, but this still requires an initial 'monster' compilation to get the images externalized before the draft option could be invoked   Here's a MWE to play with  \documentclass{article} \usepackage{pgfplots}  \begin{document}  \begin{tikzpicture}     \begin{axis}         \addplot {x^2};     \end{axis} \end{tikzpicture}  \end{document} Line numbering paragraph oriented? I'm using the lineno package with the pagewise option but I need a way to get the numbering restart every paragraph break. I need a general solution to pass to the latex command, e.g.:  latex "\AtBeginDocument{\RequirePackage[pagewise]{lineno}\linenumbers}\input{mydocument.tex}"   I read the lineno manual but the package does not provide this feature. Is there any trick to do that? Proof that $\bigcap_{a\in A} \bigg(\, \bigcup_{b\in B} F_{a,b} \, \bigg) = \bigcup_{f\in ^AB} \bigg(\, \bigcap_{a \in A} F_{a,f(a)}\,\bigg) $ I found an interesting exercise of other amazing book (Jech's) that I'm not totally sure about how to do it.   Prove the following form of the distributive law:   $$\bigcap_{a\in A} \bigg(\, \bigcup_{b\in B} F_{a,b} \, \bigg) = \bigcup_{f\in ^AB} \bigg(\, \bigcap_{a \in A} F_{a,f(a)}\,\bigg) $$  Assuming that $F_{a,b_1} \cap F_{a,b_2} = \emptyset $ for each $a\in A$ and $b_1,b_2\in B$ and $b_1\not=b_2$.  First of all, I'm not completely sure about what $ F_{a,b}$ really means. I suppose that is  the range of a family with a domain $A \times B$.    And second, I cannot figure out how to do the converse (assuming that the first part it is correct, I used as normal in this kind of proof element chasing)  Proof:  ($\Rightarrow$) ...  ($\Leftarrow$) Suppose that $z\in \bigcup_{f\in ^AB} \big(\, \bigcap_{a \in A} F_{a,f(a)}\,\big)$; then there is $f\in \,^AB$ such that $z\in  \bigcap_{a \in A} F_{a,f(a)}\, $. Let $a \in A$ be arbitrary.   Claim 1 $\, \bigcap_{a \in A} F_{a,f(a)}\subseteq F_{a,f(a)} \subseteq \bigcup_{b\in B} F_{a,b}$.  Proof of the Claim 1:   For the first inclusion: Suppose $z\in\bigcap_{a \in A} F_{a,f(a)}$; then for each $a\in A$ we have that $z\in F_{a,f(a)}$. Then $\bigcap_{a \in A} F_{a,f(a)}\subseteq F_{a,f(a)}$.  For the second inclusion: Now suppose $z\in F_{a,f(a)}$. Clearly $f(a)\in B$ because $f\in ^AB$. Then there is some $b\in B$ such that  $z\in F_{a,b}$ and hence that $z\in \bigcup_{b\in B} F_{a,b}$. $\square$  Since $a$ was arbitrary it follows that $z\in \bigcup_{b\in B} F_{a,b}$ (by claim 1) for each $a\in A$ and hence  that $z\in \bigcap_{a\in A} \big(\, \bigcup_{b\in B} F_{a,b} \, \big)$ as desired.  I really, really would very much appreciate some help with that. Thanks in advance as usual. Examples of PCA where PCs with low variance are "useful" Forgot which email I used, can't login I forgot what email I used for my other ploxtic id: how do you find out what my email was?   The account is user:2078229. Does Windows log programs that have been run/called? Pronunciation differences between "finite" and "infinite" In my experience, "finite" is pronounced (IPA) ˈfaɪnaɪt while "infinite" is ˈɪnfɪnɪt.  In general, the prefix "in" negates an adjective, but does not change the pronunciation. Based on this, I would expect ˈɪnfaɪnaɪt.  Is there a reason for this "deviation from the norm"? Are there dialects/regions that actually say ˈɪnfaɪnaɪt (or ˈfɪnɪt, for that matter)? Better than premium Is there something higher (better) than the word premium, or does it mean the best? Also, is there something in between premium and deluxe?  Graphically: Does any word fit here? > Premium > Does any word fit here? > Deluxe Once a world enters hardmode, corruption and hallows being spreading at an alarming rate, including the underground. Grass, which grows on dirt, succumbs easily to both. Jungles and glowing mushrooms grow on mud and provide unique and valuable items. Will corruption/hallows destroy these if left unchecked? If they do destroy mud-based life, how can I preserve these fragile ecosystems?