with
open(
'.
\\
A
\\
tianqi.txt')
as From_file:
#try:
for each_line
in From_file:
print(each_line)
#finally:
From_file.close()
import csv with open("D:/python/A/iris.csv","r",encoding="utf-8") as f: reader = csv.reader(f) header = next(reader) for row in reader: print(row)
with open("D:/python/A/iris.csv","r",encoding="utf-8") as f: reader = csv.reader(f) header = next(reader) for row in reader: print(row[1]) with open("d:/python/B/1906.txt") as f: for line1 in f: print(line1) print("------") with open("d:/python/B/1906.txt") as f: for line2 in f: print(line2.rstrip())