ใช้ tempfile.mkstemp() สร้าง temporary file แบบปลอดภ ไม่มี race condition ไฟล์อ่าน/เขียนได้เฉพาะ user ที่สร้าง
import tempfile
_, temp_file_path = tempfile.mkstemp()
print("File path: " + temp_file_path)
หมายเหตุ: ต้องลบไฟล์นี้เองหลังใช้งานเสร็จ
ใช้ tempfile.mkstemp() สร้าง temporary file แบบปลอดภ ไม่มี race condition ไฟล์อ่าน/เขียนได้เฉพาะ user ที่สร้าง
import tempfile
_, temp_file_path = tempfile.mkstemp()
print("File path: " + temp_file_path)
หมายเหตุ: ต้องลบไฟล์นี้เองหลังใช้งานเสร็จ