About the Tutorial



Download 2,85 Mb.
Pdf ko'rish
bet208/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   204   205   206   207   208   209   210   211   ...   234
Bog'liq
python3 tutorial 060821094426

os.tcsetpgrp() Method 
Description 
The method tcsetpgrp() sets the process group associated with the terminal given by fd 
(an open file descriptor as returned by os.open()) to pg. 
Syntax 
Following is the syntax for tcsetpgrp() method- 
os.tcsetpgrp(fd, pg) 
Parameters 

fd
- This is the file descriptor. 

pg
- This set the process group to pg. 
Return Value 
This method does not return any value. 
Example 
The following example shows the usage of tcsetpgrp() method. 
# !/usr/bin/python3 
import os, sys 
# Showing current directory
print ("Current working dir :%s" %os.getcwd()) 
# Changing dir to /dev/tty 
fd = os.open("/dev/tty",os.O_RDONLY) 
f = os.tcgetpgrp(fd) 
# Showing the process group 
print ("the process group associated is: ") 
print (f) 


Python 3 
313 
# Setting the process group 
os.tcsetpgrp(fd,2672) 
print ("done") 
os.close(fd) 
print "Closed the file successfully!!" 
When we run the above program, it produces the following result- 
Current working dir is :/tmp 
the process group associated is: 
2672 
done 
Closed the file successfully!! 
os.tempnam() Method 
Description 
The method tempnam() returns a unique path name that is reasonable for creating a 
temporary file. 
Syntax 
Following is the syntax for tempnam() method- 
os.tempnam(dir, prefix) 
Parameters 

dir
- This is the dir where the temporary filename will be created. 

prefix
- This is the prefix of the generated temporary filename. 
Return Value 
This method returns a unique path. 
Example 
The following example shows the usage of tempnam() method. 
# !/usr/bin/python3 
import os, sys 
# prefix is tuts1 of the generated file 
tmpfn = os.tempnam('/tmp/tutorialsdir,'tuts1') 


Python 3 
314 
print "This is the unique path:" 
print tmpfn 
When we run the above program, it produces the following result- 
This is the unique path: 
/tmp/tutorialsdir/tuts1IbAco8 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   204   205   206   207   208   209   210   211   ...   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