Python membaca baris file demi baris
with open("file.txt") as file_in:
lines = []
for line in file_in:
lines.append(line)
Caleb McNevin
with open("file.txt") as file_in:
lines = []
for line in file_in:
lines.append(line)
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()
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