I have a file that has a header on the first line. I want to ignore the first line and give the rest to the function. What should I do?
text:
App∑Category∑Rating∑Reviews∑Size∑Installs∑Type∑Price∑Content Rating∑Genres∑Last Updated∑Current Ver∑Android Ver
Photo Editor & Candy Camera & Grid & ScrapBook∑ART_AND_DESIGN∑4.1∑159∑19M∑10,000+∑Free∑0∑Everyone∑Art & Design∑7-Jan-18∑1.0.0∑4.0.3 and up
Coloring book moana∑ART_AND_DESIGN∑3.9∑967∑14M∑500,000+∑Free∑0∑Everyone∑Art & Design;Pretend Play∑15-Jan-18∑2.0.0∑4.0.3 and up
Code:
def mapper(_, line):
line= line[1:]
You could do it this way:
def process(lines):
pass # iterate over and process lines
with open('some file') as infile:
process(infile.readlines()[1:])
Note: this will fail if the file is empty
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.