About the Tutorial



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

os.symlink() Method 
Description 
The method symlink() creates a symbolic link dst pointing to src. 
Syntax 
Following is the syntax for symlink() method- 
os.symlink(src, dst) 
Parameters 

src
- This is the source. 

dest
- This is the destination, which did not exist previously. 
Return Value 
This method does not return any value. 
Example 
The following example shows the usage of symlink() method- 
#!/usr/bin/python3 
import os 
src = '/usr/bin/python3' 
dst = '/tmp/python' 
# This creates a symbolic link on python in tmp directory 
os.symlink(src, dst) 
print "symlink created" 
Let us compile and run the above program, this will create a symbolic link in /tmp directory 
which will be as follows- 


Python 3 
311 
lrwxrwxrwx. 1 root root 15 Apr 30 03:00 python -> /usr/bin/python3 
os.tcgetpgrp() Method 
Description 
The method tcgetpgrp() returns the process group associated with the terminal given by 
fd (an open file descriptor as returned by os.open()) 
Syntax 
Following is the syntax for tcgetpgrp() method- 
os.tcgetpgrp(fd) 
Parameters 
fd
- This is the file descriptor. 
Return Value 
This method returns the process group. 
Example 
The following example shows the usage of tcgetpgrp() 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) 
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: 


Python 3 
312 
2670 
Closed the file successfully!! 

Download 2,85 Mb.

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