[Tutor] put?

Kent Johnson kent37 at tds.net
Thu May 1 11:49:33 CEST 2008


On Thu, May 1, 2008 at 3:51 AM, Ross Glover <ross at ross.mayfirst.org> wrote:
> Hi, I'm just learning python (as a first language) and I wrote this little
> snippet (cribbed from a website).  I'm wondering what 'put' is and how it's
> used.  I cannot seem to find much about it.
>
>
> > word = raw_input("enter your word >>")
> > put, get=os.popen4("dict -d wn " + (word))
> > for lines in get.readlines():
> >    print lines

put and get are variables that receive the result of the call to
popen4(). The docs for popen4() are here:
http://docs.python.org/lib/os-newstreams.html#os-newstreams

It says popen4() "returns the file objects (child_stdin,
child_stdout_and_stderr)", so put is linked to stdin for the child
process.

Kent


More information about the Tutor mailing list