# turn a comma delinated text field for the format below into the format # for import into a Xerox printer/copier # format is name comma email address newline text = """name, name@email.org name2, name2@email.org name3, name3@email.org """ import string for line in string.split(text, "\n"): stuff = string.split(line, ", ") print ",MAIL,%s,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,%s,,,,,,,,,,,," % (stuff[0], stuff[1])