When reading the file in python, How can I remove the first line of the file?
Here is my text file:
Country|Population|Area
China|1,339,190,000|9,596,960.00
United States of America|309,975,000|9,629,091.00
Brazil|193,364,000|8,511,965.00
Japan|127,380,000|377,835.00
filename = input('Enter file name: ')
f = open(filename, 'r')
first_line = True
for line in f:
if first_line: # ignore first line
first_line = False
else: # process rest of the lines
print(line.strip()) # I am just printing rest of the lines, you can use it do anything..
f.close()
When reading the file in python, How can I remove the first line of the file?...