Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

filter blank rows python csv

def no_blank(fd):
    try:
        while True:
            line = next(fd)
            if len(line.strip()) != 0:
                yield line
    except:
        return
#Read the CSV file.
with open('campaign_monthly_report.csv', 'r') as csv_file:
    csv_reader = csv.DictReader(no_blank(csv_file))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #filter #blank #rows #python #csv
ADD COMMENT
Topic
Name
4+8 =