There are multiple text files in a folder and the requirement is to write a python code to read all the text files and extract date field after this bit of text &quot;$published_date:&quot; (For example ,published_date: January 02 2020) from each of the text files . All files look like this :-     $Publisher_Name: ABC Corp.                                                                 $Publisher_Date: January 02 2020.                                                                      This copy was authored by xyz.       Files consist of several lines along with &quot;$Publisher_Date:  &quot; printed somewhere on each file . Need help to change the date format from  datestring (e.g &quot;'January 03 2020'&quot; ) to  &quot; 'dd/mm/yyyy' &quot; in below code. Here is the python code , where i am trying to read text files from basepath and extract date value after this bit of text &quot;published_date:&quot;  .     import re       import os     import dateparser          basepath = (r&quot;path\test&quot;)     with os.scandir(basepath) as entries:         for entry in entries:             if entry.is_file():                 fn=entry.name          def f(fn):         with open(fn) as f:             for s in f:                 # match text between Publisher_Date: and '.'                 m = re.search('(?&lt;=Publisher_Date: ).[^.]*', s)                 if m:                     return(fn, m.group()) # # tuple (filename, date)             else:                 return None # no match in file          if __name__==&quot;__main__&quot;:         folder = (r&quot;path\test/&quot;)         _,_,filenames = next(os.walk(basepath))         dates = []         #dateparser.parse(dates = [])                  for i in filenames:             print(f(folder + i) ,dates)                I am getting below output from my code :-     path\tes2.txt', 'January 03 2020'     path\tes3.txt', 'January 23 2021'  Looking to get rid of path location and changed date format in my desired output .     **My Desired output is**           test2.txt    03/01/2020     test3.txt    23/01/2021     test4.txt    15/03/2019
This is my code:  import datetime today = datetime.date.today() print(today)   This prints: 2008-11-22 which is exactly what I want.  But, I have a list I'm appending this to and then suddenly everything goes "wonky". Here is the code:  import datetime mylist = [] today = datetime.date.today() mylist.append(today) print(mylist)   This prints the following:   [datetime.date(2008, 11, 22)]   How can I get just a simple date like 2008-11-22?
How to submit a form when the return key is pressed? Can someone please tell me how to submit an HTML form when the return key is pressed and if there are no buttons in the form? The submit button is not there. I am using a custom div instead of that. This is a special case of , which, I think, might have drawn little attention because it was too general. In this question, I would like to consider a specific case.  Take a classical system given by the action $$ S[x] = \int dt \left[ \frac{\alpha}{2} \ddot{x}^2 + \frac{\beta}{2} \dot{x}^2 + \frac{\gamma}{2} x^2 \right]. $$  This action is Lagrangian, but it is not what we are usually dealing with in physics, because the Lagrangian contains second time derivatives.  The equations of motion are:  $$ \alpha \ddddot{x} - \beta \ddot{x} + \gamma x = 0. $$  This can be solved as usual by employing Fourier transform:  $$ x(t) = a_1 e^{i \omega_1 t} + a_1^{*} e^{-i \omega_1 t} + a_2 e^{i \omega_2 t} + a_2^{*} e^{-i \omega_2 t}, $$  where $\omega_1^2$ and $\omega_2^2$ are the two roots of $\alpha \omega^4 + \beta \omega^2 + \gamma$, given by  $$ \omega_{1,2}^2 = \frac{- \beta \pm \sqrt{\beta^2 - 4 \alpha \gamma}}{2 \alpha} .$$  Now by definition the phase space is the space of solutions of equations of motion. In this case it is parametrized by two complex co-ordinates $a_{1,2}$, meaning that it is 4-dimensional.  I would like to know if there's a natural way to associate the symplectic structure (Poisson bracket) on this phase space. I.e.,  $$ \{a_1, a_1^{*}\} = ? $$ $$ \{a_1, a_2^{*}\} = ? $$ $$ \{a_2, a_1^{*}\} = ? $$ $$ \{a_2, a_2^{*}\} = ? $$ $$ \{a_1, a_2\} = ? $$ $$ \{a_1^{*}, a_2^{*}\} = ? $$ How to kill applications I have been playing around with Ubuntu installing new themes and and docks. Sometimes during the installation, whole screen just hangs. What is the best way in Ubuntu to Kill a process/application? Anything similar to Ctrl + Alt + Del of windows? I have a question about my choice of name for publication.  I recently got married and legally changed my name to my husband's surname (for example's sake: from Hunter to Jones). So, despite legally being Ms Jones now, I would quite like to use the hyphenated name Hunter-Jones in the professional context and in publications. This is so that people realise that it is still me and so that I can somewhat keep my maiden name.  Is this possible or do I have to use my legal name professionally and when publishing? Thank you for any help Traditional search-as-you-type on newer Nautilus versions Until now I was using a "traditional" version of Nautilus: that that comes with Ubuntu 10.10. Now I'm using 3.6.3, included with Ubuntu 13.04 (most likely any recent version is equivalent for the scope of my question, anyway).  One major difference between the two is the search-as-you-type behavior: in classic versions of Nautilus, when you typed an input, the file with the closest alphabetical match would become the selected one, the eligible files/folders being restricted to the current directory.  The new behavior is to perform an optionally-global search instead.  Can one configure Nautilus to provide the previous functionality ? This is from page 3 of  ().  Copying the relevant segment:     Stirling’s approximation tells us $\sqrt{2\pi n} (n/e)^n \leq n! \leq e^{1/12n} \sqrt{2\pi n} (n/e)^n$. In particular we can use this to say that   $$ {n \choose k} \leq \left(\frac{en}{ k}\right)^k$$   I tried the tactic of combining bounds from $n!$, $k!$ and $(n-k)!$ and it didn't work. How does this bound follow from stirling's approximation? My new 1,5 TB ext4 Hard Disk makes mysterious noises and fails to read and write. But not always. Sometimes it just works. But then I get those following errors. Does anyone know a solution for that or is my new WD Caviar Black 1.5 TB hard disk broken?  [  551.162286] ata7: SATA link down (SStatus 0 SControl 310) [  551.162294] ata7.00: link offline, clearing class 1 to NONE [  551.178223] ata7: EH complete [  551.190802] ata7: exception Emask 0x10 SAct 0x0 SErr 0x4040000 action 0xe frozen [  551.190807] ata7: irq_stat 0x00000040, connection status changed [  551.190811] ata7: SError: { CommWake DevExch } [  551.190818] ata7: limiting SATA link speed to 1.5 Gbps [  551.190822] ata7: hard resetting link   Update Mainboard P7P55D LE: What is $n!$ when $n=0$? I encountered such a formula for pooled variance:  $$\frac{(n-1)s_x^2+(m-1)s_y^2}{n+m-2}\left(\frac{1}{n} + \frac{1}{m}\right)$$  Here we have two samples of the following sizes $n$ and $m$. $s_x, s_y$ are the sample variances.  I understand that the first term is a weighted average, but from the second term comes? Opening Chromium on Ubuntu VPS Ubuntu noob here. I recently got a VPS running Ubuntu, and decided to install Chromium, my preferred browser, on it. After installation completed, I got a message stating that I cannot open Chromium with root privileges. How would I go about opening Chromium? When I entered the value $$\frac{1}{i}$$ in my calculator, I received the answer as $-i$ whereas I was expecting the answer as $i^{-1}$. Even google calculator shows the same answer (Click  to check it out).  Is there a fault in my calculator or $\frac{1}{i}$ really equals $-i$? If it does then how? To give some background, I am attempting to solve the problem from Artin's algebra textbook which was already asked in this link:  Now, I would like to prove the following two claims which are not obvious to me. If I can prove these, I will be able to show that $\zeta_5\notin \mathbb{Q(\zeta_7)}$ as needed. I suspect that both claims will have similar proofs.  Claim 1: $\zeta_5$ has degree $4$ over $\mathbb{Q}$ Claim 2: $\zeta_7$ has degree $6$ over $\mathbb{Q}$  Attempt to prove Claim 1 Let $α=\zeta_5$. I would like to find the monic irreducible polynomial for $α$, but unfortunately I do not know what it is yet. I see $α=cos(\frac {2π}5)+isin(\frac {2π}5)$ and $α^4=cos(\frac {4π}5)+isin(\frac {4π}5)$. Please help me to find the irreducible polynomial, and (ideally) to show that it is irreducible. Use grep --exclude/--include syntax to not grep through certain files I was compiling a tool called Rejoystick so I installed a few packages and dependencies. But now I don't need it any more so I removed those packages. Running apt-get shows that I have some packages that are automatically installed and are no longer needed.   But I have a bad experience with apt-get autoremove. It broke my desktop environment when I uninstalled wine some time ago. Luckily, I had a clonezilla partition backup then, but this time, I don't have a backup. So I'm cautious. Running apt-get shows these packages are orphaned     gir1.2-gtk-2.0 libasound2-dev libavahi-client-dev libavahi-common-dev   libcaca-dev libcairo-script-interpreter2 libdbus-1-dev libdrm-dev   libexpat1-dev libfontconfig1-dev libfreetype6-dev libgl1-mesa-dev   libglu1-mesa-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev   libpcre3-dev libpcrecpp0 libpixman-1-dev libpng12-dev libpthread-stubs0-dev   libslang2-dev libsm-dev libx11-dev libx11-doc libx11-xcb-dev libxau-dev   libxcb-dri2-0-dev libxcb-dri3-dev libxcb-glx0-dev libxcb-present-dev   libxcb-randr0-dev libxcb-render0-dev libxcb-shape0-dev libxcb-shm0-dev   libxcb-sync-dev libxcb-xfixes0-dev libxcb1-dev libxcomposite-dev   libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev   libxft-dev libxi-dev libxinerama-dev libxrandr-dev libxrender-dev   libxshmfence-dev libxxf86vm-dev mesa-common-dev x11proto-composite-dev   x11proto-core-dev x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev   x11proto-gl-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev   x11proto-record-dev x11proto-render-dev x11proto-xext-dev   x11proto-xf86vidmode-dev x11proto-xinerama-dev xorg-sgml-doctools xtrans-dev   zlib1g-dev   I'm not sure if I should run apt-get autoremove. I was searching details related to each of these packages so that I can understand which ones are needed but they all seem important e.g.     gir1.2-gtk-2.0    I have Cinnamon, GNOME and Unity installed, I think apt-get autoremove will break something. Any help will be appreciated.   Thanks for reading. Creating node shapes I am currently learning how to use TikZ/PGF to make some figures for a project report, and so I have a question:     Is there is a practical way of making a particular object into a node?   The object I have in mind is shown in the Figure below. I want the object to consist in the big circle, the two circular arcs, the label and anchors at north, south, east and west. The dotted lines are simply there to indicate that I am going to have paths going out of these points, which is why I need the anchors there.     I include the source, in the case that it is useful to anyone.  \begin{tikzpicture} \draw[help lines, gray, dotted] (-2,-2) grid (2,2);  \begin{scope}[shift={ (0,0) } ]     \begin{scope}[rotate=90]         \draw[thick] (-1,0) arc[start angle=-90, delta angle=90, %                               x radius=1, y radius=1] -- (0,1) %NW                      (0,-1) arc[start angle=180, delta angle=-90, %                                    x radius=1, y radius=1] -- (1,0); %SE         \draw[gray] (0,0) circle (1);     \end{scope} % Anchor replacements     \node(N1)       at (0,1)    {};     \node(S1)       at (0,-1)   {};     \node(E1)       at (1,0)    {};     \node(W1)       at (-1,0)   {}; % Label     \node(Crossing number) at (0,0) {1}; \end{scope}  \path[thick, gray, dotted] [ out=90,   in=270]     (N1.center) edge (0,2) [ out=180,  in=0]       (W1.center) edge (-2,0) [ out=270,  in=90]      (S1.center) edge (0,-2) [ out=360,  in=180]     (E1.center) edge (2,0); \end{tikzpicture}   PS. I have had a look at the Manual, but I could not find a description of how to do this. My headphones are not playing voices, but only the music I want to have a script that takes the current working directory to a variable. The section that needs the directory is like this dir = pwd. It just prints pwd how do I get the current working directory into a variable? If $p$ is prime, then $(x+y)^p=x^p+y^p$ holds in any field of characteristic $p$. However all the proofs I have seen use induction and some relatively nasty algebra despite how fundamental this fact seems.  What is the nicest, "highest level proof" you know? Making a log4j console appender use different colors for different threads How find this limit $\lim\limits_{x\to 0^{+}}\frac{\sin{(\tan{x})}-\tan{(\sin{x})}}{x^7}$