Answers for "how to file in python"

30

python make txt file

file = open("text.txt", "w") 
file.write("Your text goes here") 
file.close() 
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' open for exclusive creation, failing if the file already exists
'a' open for writing, appending to the end of the file if it exists
Posted by: Guest on April-04-2020
0

how to file in python

Simple way to get a directory of a file and open it:
  
from tkinter.filedialog import askopenfilename

filename = askopenfilename()
Posted by: Guest on March-09-2021

Code answers related to "how to file in python"

Python Answers by Framework

Browse Popular Code Answers by Language