python csv

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#! /usr/bin/env python
import csv
import sys
import codecs

def handler_line(src_list):
    desc_list = []
    for item in src_list:
        print item
        desc_list.append(item+"cccccccccccc")
    return desc_list

def handler_csv(file_name):
    src_file = open(file_name,"r");
    write = csv.writer(codecs.open("new_demand.csv","w","utf-8"))
    is_first = True

    for line in src_file:
        if is_first:
            is_first = False
            continue
        item_list = line.split(',')
        item_desc_list = handler_line(item_list)
        write.writerow(item_desc_list)

    src_file.close()

if __name__ == '__main__':
    handler_csv(sys.argv[1])