About the Tutorial



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

os.tmpfile() Method 
Description 
The method tmpfile() returns a new temporary file object opened in update mode (w+b). 
The file has no directory entries associated with it and will be deleted automatically once 
there are no file descriptors. 
Syntax 
Following is the syntax for tmpfile() method- 
os.tmpfile 
Parameters 
NA 
Return Value 
This method returns a new temporary file object. 
Example 
The following example shows the usage of tmpfile() method. 
# !/usr/bin/python3 
import os 
# The file has no directory entries associated with it and will be 
# deleted automatically once there are no file descriptors. 
tmpfile = os.tmpfile() 
tmpfile.write('Temporary newfile is here.....') 
tmpfile.seek(0) 
print tmpfile.read() 


Python 3 
315 
tmpfile.close 
When we run the above program, it produces the following result- 
Temporary newfile is here..... 
os.tmpnam() Method 
Description 
The method 
tmpnam()
returns a unique path name that is reasonable for creating a 
temporary file. 
Syntax 
Following is the syntax for tmpnam() method- 
os.tmpnam() 
Parameters 
NA 
Return Value 
This method returns a unique path name. 
Example 
The following example shows the usage of tmpnam() method. 
# !/usr/bin/python3 
import os, sys 
# Temporary file generated in current directory 
tmpfn = os.tmpnam() 
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/fileUFojpd 
os.ttyname() Method 
Description 


Python 3 
316 
The method 
ttyname()
returns a string, which specifies the terminal device associated 
with fd. If fd is not associated with a terminal device, an exception is raised. 

Download 2,85 Mb.

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