with open ("data.txt", "r") as myfile:
data = myfile.read().splitlines()
# read and print all contents of a file
with open('data.txt', 'r') as f:
contents = f.read()
print(contents)
# loop through file line by line removing newlines
with open('data.txt', 'r') as f:
for line in f:
print(line.rstrip())
# read first 14 bytes of file
with open('data.txt', 'r') as f:
print(f.read(14))
print(f"The current file position is {f.tell()}")
# move to beginning of file
f.seek(0, 0)
# print 30 bytes from position
print(f.read(30))
# where f is the file alias
with open(r"path ofile.txt", encoding='UTF8') as f:
contents = f.read()
print(contents)
f=open("Diabetes.txt",'r')
f.read()
file = '/home/text/chapter001.txt'
f=open(file,'r')
data = f.read()
print('data =',data)
import pandas as pd
color_table = pd.read_table("/content/drive/My Drive/Site sharing/PSD Resources/Colors.txt")
print(color_table)