How do you skip the first line in Python?

How do you skip the first line in Python?
Answer
Call next(file) to skip the first line of the file.
  1. a_file = open(“example_file.txt”)
  2. next(a_file)
  3. for line in a_file:
  4. print(line. rstrip())
  5. a_file.
 

Tìm kiếm

Back
Top