popen - reading strings - constructing a list from the strings

Aytekin Vargun varguna at gmail.com
Wed May 20 13:53:28 EDT 2009

First of all,
Thanks for the suggestions, MRAB and norseman. "split()" was what I was
looking for. Now I have a follow up question. In my application I create
radio buttons in a frame. These radio buttons are constructed whenever a
button is clicked. Therefore the list of items are dynamically changing.

What I want to do is to remove the current radio buttons and then recreate a
new set of radio buttons using a new string list. I could not see a command
for deleting or removing a set of radio buttons. I use Tkinter.

I can provide more details.
Thanks a lot.

PS: I apologize if this creates a new thread. I am new to the list.

On Wed, May 20, 2009 at 11:17 AM, Aytekin Vargun <varguna at gmail.com> wrote:

> <python-list at python.org>
> Hello everybody,
> 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=data
> 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
> Aytekin
> --
> My web page: http://www.cs.rpi.edu/~vargua<http://www.cs.rpi.edu/%7Evargua>

My web page: http://www.cs.rpi.edu/~vargua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090520/a72eefab/attachment.html>

More information about the Python-list mailing list