Answers for "open file in os python"

1

python open file

fileName = "file_name.txt" #Here you need to write the file name as a string

openLike = "" #Here you need to write how do you want to open the file:
#"w": Write, "r": Read
openedFile = open("file_name.txt", openLike) #Here you open the file
fileText = openedFile.read() #This read all the file
openedFile.close() #Close the file
print(fileText) # Prints the file text
Posted by: Guest on January-04-2022
0

open file in os python

import os

os.system('filename.extension')
Posted by: Guest on March-28-2022

Python Answers by Framework

Browse Popular Code Answers by Language