Hello dear readers! Welcome back to another section of our tutorial on Python. In this tutorial guide, we are going to be studying about the Os openpty() method.
The Python os openpty() method opens a pseudo-terminal pair and then it returns a pair of the file descriptors (master, slave) for the pty & tty respectively.
The Python os openpty() method opens a pseudo-terminal pair and then it returns a pair of the file descriptors (master, slave) for the pty & tty respectively.
Syntax
The following below is the syntax for Python Os openpty() method -
os.openpty( )
RECOMMENDED POST: Python os.open() Method with example
Parameter Details
- NA
Return Value
It returns a pair of the file descriptors I.e., master and slave.
Example
The following below is a simple example -
# !/usr/bin/python import os # master for pty, slave for tty m,s = os.openpty() print m print s # showing terminal name s = os.ttyname(s) print m print s
Output
When the above code is executed, it will produce the following result -
3 4 3 /dev/pty0
RECOMMENDED POST: Python os.minor() Method with example
Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the Python OS pathconf() Method.
Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.