【发布时间】:2015-02-19 09:42:25
【问题描述】:
import os
import csv
def get_file_path(filename):
currentdirpath = os.getcwd()
file_path = os.path.join(os.getcwd(), filename)
print(file_path)
return(file_path)
path = get_file_path('Invoice-Item.csv')
def read_csv(filepath):
with open(filepath, 'r') as csvfile:
reader = csv.reader(csvfile)
for i in range(0, 9):
next(reader, None)
for row in reader:
print(row[0])
read_csv(path)
我正在寻找一种跳过 9 个标题而不是范围函数的技术。任何帮助,将不胜感激。下面是一个csv文件的示例
Summary Journal Entry,JE-00000060
Journal Entry Date,28/02/2015
Accounting Period,Feb-15
Accounting Period Start,1/02/2015
Accounting Period End,28/02/2015
Included Transaction Types,Invoice Item
Included Time Period,01/02/2015-09/02/2015
Journal Run,JR-00000046
Segments,
,
Customer Account Number,Transaction Amount
210274174,545.45
210274174,909.09
210274174,909.09
210274174,909.09
210274174,909.09
【问题讨论】:
标签: python csv python-3.x