grep -r in python -


I want to apply the unix command 'grep -r' to the arguments function. I know about the command .getstatusoutput (), but for now I do not want to use it. I came with: og for o in oswalk (dir) for og [o] [0] + "/" + o [grep_r (str, dir): def grep_r [ 2] If the os.path.isfile (o [0] + "/" + f) returns in [L] files for L in the open (F) if LLL]

But certainly does not use a regex, it just checks that 'str' has a space 'l' so I tried the following:

  def grep_r (patterns, DIR): r = recompile (pattern) files = [o [0] + "/" + o for o. In the O for walking in the O (DIR) [2] if the OS is in the files for the F. path.isfile (o [0] + "/" + F)] returns (L for the f) if r. Match (l)]  

but that does not work, it is not giving me any matches where the first thing was done. What changed? I got it one of nested loops I can divide the bunch, but I am more interested than being readable.

From:

Python Two offer different primitive tasks based on regular expression: In the beginning of the string match checks for only one match, while the search was searched for any match in the string (this is the Perl by default).


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -