chentianran/darwin — comment on commit 32b192698cd36826de116d23ac175bed569246a0
File: test.py line 11
By ovenhouse:

I realize that some of the code is redundant or just plain silly. I was doing a lot of trial and error with the different command-line functions ( call(), check_output(), etc... ), so some of it was specific to a certain method, and I didn't change it when I went to another.

I originally turned on the multiline flag because the '^' symbol was only tellig it to search the beginning of the string and the function I was using at the time returned one large string, which was not yet split up into lines.

When I opened the text file that was already created before running the program, the regular expressions parser worked perfectly, and only returned what it should. But when I started using the call() and Popen() and check_output() functions, the search() function was giving more than it seems it should have. Maybe the regular expressions work slightly different in python than the syntax you were using in Ruby...? My other thought was that the text file could more easily be read line-by-line, so it didn't have to be split up, and the MULTILINE flag wouldn't be necessary.

I'm wondering if those functions ( call(), check_output(), and Popen() ) can be given command line parameters to make the program write to a file (like the ">" symbol) and then just have the python program read from that file right afterwards.