Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18702 > unrolled thread

Re: [BangPypers] re module help

Started byNoufal Ibrahim <noufal@nibrahim.net.in>
First post2012-01-09 14:45 +0530
Last post2012-01-09 14:45 +0530
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [BangPypers] re module help Noufal Ibrahim <noufal@nibrahim.net.in> - 2012-01-09 14:45 +0530

#18702 — Re: [BangPypers] re module help

FromNoufal Ibrahim <noufal@nibrahim.net.in>
Date2012-01-09 14:45 +0530
SubjectRe: [BangPypers] re module help
Message-ID<mailman.4543.1326100744.27778.python-list@python.org>
Ganesh Kumar <bugcy013@gmail.com> writes:

> Hi Guys,
>
> I have created regular expression with os modules, I have created file
> sdptool to match the regular expression pattern, will print the result.
> I want without creating file how to get required output, I tried but i
> didn't get output correctly, over stream.

You should use the subprocess module to deal with external commands.

>>> import subprocess
>>> s = subprocess.Popen(["head", "/etc/hosts"], stdout = subprocess.PIPE)
>>> hosts_head = s.stdout.read()
>>> print hosts_head
127.0.0.1       localhost

[...]

Use that get your output and then parse it with the regexp.


-- 
~noufal
http://nibrahim.net.in

The best cure for insomnia is to get a lot of sleep. -W. C. Fields

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web