popen - reading strings - constructing a list from the strings
varguna at gmail.com
Wed May 20 17:17:50 CEST 2009
<python-list at python.org>
I have a question about the way I use os.popen. I am open to other
alternative suggestions like using subprocess or communicate.
I have an executable (say read_cell_types.exe) that produces string outputs.
For example, after one execution I got the following outputs in one line:
Neurons Microglia Astrocytes
In another execution, there might be different numbers of strings.
What I would like to do is to get these strings after running
read_cell_types.exe from my python program dynamically and construct radio
buttons from the list of strings. In order to do this I need to construct a
list of strings first as in
["Neurons" "Microglia" "Astrocytes"]
Then it is easy to construct the radio buttons.
When I use the following code
command = "read_cell_types " + fileName2
child = os.popen(command)
data = child.read()
allObjects (or data) contains the letters of all string words. I think it is
probably like ["N" "e" "u" "r" ...]
How can I construct ["Neurons" "Microglia" "Astrocytes"] instead?
I will really appreciate your help.
Thanks a lot.
PS: fileName2 is a parameter that I am passing to read_cell_types.exe
My web page: http://www.cs.rpi.edu/~vargua
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list