Commit 130564a3 authored by Mario Hock's avatar Mario Hock
Browse files

csv.reader and csv.DictReader

Also, skipinitialspace=True.
parent 72b65a20
......@@ -59,11 +59,22 @@ if __name__ == "__main__":
header = read_header(in_file)
print( json.dumps(header, sort_keys=True, indent=4) ) ## XXX
## XXX
print ("///")
print()
for l in csv.reader( cnl_slice(in_file, "%% Begin_Body", "%% End_Body") ):
## Read as lists
#csv_reader = csv.reader( cnl_slice(in_file, "%% Begin_Body", "%% End_Body"), skipinitialspace=True )
#csv_header = next(csv_reader)
#print( csv_header )
## Read as dicts
csv_reader = csv.DictReader( cnl_slice(in_file, "%% Begin_Body", "%% End_Body"), skipinitialspace=True )
## print
for l in csv_reader:
print( l )
#print( l["eth0.send"] + ", " + l["eth0.receive"] )
pass
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment