Hi guys,

My university recently switched mail services and in order to maintain our new listservs we have to import the emails using a different format. I have all the emails in a text file like this:

test@testing.com
test2@testing.com
test3@testing.com

In order to import it to the new mailing system it has to be in this format:

<test@testing.com> ""
<test2@testing.com>""
<test3@test.com>""

since there are lot of records I don't want to go through and edit each individually. I can import the text file, but just cannot add the characters to the list, I have tried li.append, but can't figure out why it will not work. Any help would be greatly appreciated!

thanks!

Recommended Answers

All 2 Replies

Hi there,
Welcome to daniweb. Please post down the code that you have written :). So that we could explore upon whats going on :).

oh oops my mistake.

this is what I have so far:

import sys

def maillist(file1):
    f1 = (openfile1)
    """Return new standardized email list"""
    new_list = []
    for value in f1:
        new_email = "<"+value[0:]+">"+"''"
        new_list.append(new_email)
    return new_list

f1 = (openfile1)
print (f1)
f1 = maillist(f1)
print (f1)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.