File IO: Download Numpy and Pandas Library
File IO: Download Numpy and Pandas Library
print(Str3) Cfile.close()
print(Str4) # Empty String, reading
cursor in end of the file
F2.close() with open('csvF1.csv') as F1:
CR = csv.reader(F1)
Read Lines ------------------------ R1 = []
for r in CR:
F1 = open("File1.txt",'r') R1.append(r)
print(F1.readlines()) # Output: List (of print(R1)
each line)
F1.close() Write csv files:
try:
F = open("file1.txt") 2) Using pandas Lib
print(F.read())
except: Read csv files:
raise
finally: import pandas as pd
F.close()
DF = pd.read_csv('csvF1.csv')
# With statement [Alternative for try- print(DF)
finally]: Pythonic Style