About the Tutorial


mode - This work in similar way as it works for chmod() method.  Return Value



Download 2,85 Mb.
Pdf ko'rish
bet196/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   192   193   194   195   196   197   198   199   ...   234
Bog'liq
python3 tutorial 060821094426

mode
- This work in similar way as it works for chmod() method. 
Return Value 
This method returns the file descriptor for the newly opened file. 
Example 
The following example shows the usage of open() method. 
#!/usr/bin/python3 
import os, sys 
# Open a file 
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT ) 
# Write one string 
line="this is test"
# string needs to be converted byte object 
b=str.encode(line) 
os.write(fd, b) 
# Close opened file 
os.close( fd) 
print ("Closed the file successfully!!") 
This would create given file foo.txt and then would write given content in that file and 
would produce the following result- 
Closed the file successfully!! 
os.openpty() Method 
Description 


Python 3 
294 
The method 
openpty()
opens a pseudo-terminal pair and returns a pair of file 
descriptors(master,slave) for the pty & the tty respectively. 
The new file descriptors are non-inheritable. For a (slightly) more portable approach, use 
the pty module. 
Syntax 
Following is the syntax for openpty() method- 
os.openpty() 
Parameters 
NA 
Return Value 
This method returns a pair of file descriptors i.e., master and slave. 
Example 
The following example shows the usage of openpty() method. 
# !/usr/bin/python3 
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) 
When we run the above program, it produces the following result- 



/dev/pty0 
os.pathconf() Method 
Description 


Python 3 
295 
The method pathconf() returns system configuration information relevant to a named file. 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   192   193   194   195   196   197   198   199   ...   234




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish