#! /usr/bin/python
# Usage:
# python3 python-ex-1.py infile outfile line_number
# Write to outfile the positive integers in the
line[line_number] where both input and output files are in CSV format
# e.g. if inputfile ex-1-input.csv contains
# 5,Hello,45,,12
# 43,-7,World of Mine!,12
# Yo,3,200
# and the command-line calling sequence is:
# python3 python-ex-1.py ex-1-input.csv
ex-1-output.csv 1
# Then the contents of ex-1-output.csv is the line,
with no spaces:
# 43,12
import sys
def florp():
f = open(sys.argv[1],'r')
lines = f.read().split('\n')
f.close()
entries =
lines[int(sys.argv[3])].split(',')
out = [x for x in entries if
x.isdigit() and int(x) > 0]
f = open(sys.argv[2],'w')
f.write(','.join(out))
f.close()
florp()