Question : how to open a file with python
Answered by : leon-reznor
x = open("filename.txt", "r")
print(x.read()) #if file is a txt file this will print the text
#Make sure the file is in the same directory as were your python file is opened in.
#you can also make a var out of your text by doing:
var = x.read() #or
var = open("filename.txt", "r").read()
Source : | Last Update : Fri, 10 Dec 21
Question : Open file with python
Answered by : masud-hanif
import os
my_computer = os.startfile("C:") # here c drive open this variable
print(my_computer)
Source : | Last Update : Thu, 16 Dec 21
Question : open file python
Answered by : obnoxious-ostrich-wa2vq3vpbkch
# Open function to open the file "MyFile1.txt"
# (same directory) in append mode and
file1 = open("MyFile.txt","a")
# store its reference in the variable file1
# and "MyFile2.txt" in D:\Text in file2
file2 = open(r"D:\Text\MyFile2.txt","w+")
Source : https://www.geeksforgeeks.org/reading-writing-text-files-python/ | Last Update : Thu, 13 Jan 22
Question : how to open a file in python
Answered by : grieving-goosander-zaqpq3u2qvzq
spv = open("example.txt", "r")
print(spv.red())
# r, is to make the file readable but you can have more like: a - w - x - t - b
Source : | Last Update : Sun, 17 Apr 22
Question : open file in python
Answered by : zad
import os
os.system('filename.extension')
Source : | Last Update : Mon, 04 Apr 22
Question : Opening a File in python
Answered by : softhunt
file1 = open("SofthuntFile1.txt","a")
file2 = open(r"D:\Python\Text\SofthuntFile2.txt","w+")
Source : https://softhunt.net/python-write-to-file/ | Last Update : Wed, 01 Jun 22