import pandas
def list_iterator(csvfile, *args):
print "The headers of the csv file you want printed are ", args
df = pandas.read_csv(csvfile)
# iterate through rows
for i in df.itertuples(index=False, name="namedTuple"):
print [getattr(i, x) for x in args]
if __name__ == '__main__':
list_iterator("vars2test.csv", "id")
list_iterator("vars2test.csv", "id", "varname")