Python Programming - Standard Libraries - Discussion
Discussion Forum : Standard Libraries - General Questions (Q.No. 91)
91.
How can you use the
tempfile
module in Python to create a temporary file?
Answer: Option
Explanation:
import tempfile
# Example usage of tempfile module for creating a temporary file
with tempfile.TemporaryFile() as temp_file:
temp_file.write(b'This is a temporary file content.')
temp_file.seek(0)
content = temp_file.read()
print(content)
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers