About the Tutorial


dest - This is the target file path where hard link would be created.  Return Value



Download 2,85 Mb.
Pdf ko'rish
bet189/234
Sana28.05.2022
Hajmi2,85 Mb.
#614232
1   ...   185   186   187   188   189   190   191   192   ...   234
Bog'liq
python3 tutorial 060821094426

dest
- This is the target file path where hard link would be created. 
Return Value 
This method does not return any value. Available on Unix, Windows. 
Example 
The following example shows the usage of link() method. 
#!/usr/bin/python3 
import os, sys 
# Open a file 
path = "d:\\python3\\foo.txt" 
fd = os.open( path, os.O_RDWR|os.O_CREAT ) 
# Close opened file 
os.close( fd ) 
# Now create another copy of the above file. 
dst = "d:\\tmp\\foo.txt" 
os.link( path, dst) 
print ("Created hard link successfully!!") 
When we run the above program, it produces the following result- 
Created hard link successfully!! 
os.listdir() Method 
Description 
The method 
listdir()
returns a list containing the names of the entries in the directory 
given by path. The list is in arbitrary order. It does not include the special entries '.' and 
'..' even if they are present in the directory. 
path may be either of type str or of type bytes. If path is of type bytes, the filenames 
returned will also be of type bytes; in all other circumstances, they will be of type str. 
Syntax 


Python 3 
282 
Following is the syntax for listdir() method- 
os.listdir(path) 
Parameters 
path
- This is the directory, which needs to be explored. 
Return Value 
This method returns a list containing the names of the entries in the directory given by 
path. 
Example 
The following example shows the usage of listdir() method. 
#!/usr/bin/python3 
import os, sys 
# Open a file 
path = "d:\\tmp\\" 
dirs = os.listdir( path ) 
# This would print all the files and directories 
for file in dirs: 
print (file) 
When we run the above program, it produces the following result- 
Applicationdocs.docx 
test.java 
book.zip 
foo.txt 
Java Multiple Inheritance.htm 
Java Multiple Inheritance_files 
java.ppt 
ParallelPortViewer 

Download 2,85 Mb.

Do'stlaringiz bilan baham:
1   ...   185   186   187   188   189   190   191   192   ...   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