Answers for "python file syntax"

2

python files

f = open('filename.txt', 'r') #open for reading (default)
f = open('filename.txt', 'w') #open for writing, truncating the file first
f = open('filename.txt', 'x') #open for exclusive creation, failing if the file already exists
f = open('filename.txt', 'a') #open for writing, appending to the end of the file if it exists
Posted by: Guest on September-09-2021
1

how to open a file in python

#open any file that is in your folder you are using in your editor
import os
os.startfile('Gamepicture.jfif')
Posted by: Guest on October-04-2020
2

how to open a file in python

open("filename" , "mode")
# do whatever you want to do!!
Posted by: Guest on August-24-2020
0

python file

>>> f = open('workfile', 'w')
Posted by: Guest on July-24-2021
-3

python file a?

print("ddd")
Posted by: Guest on July-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language