Hello!
I'm a python n00b! I've been writing in c++ for a few years so programming's not new to me, just python that I don't know the syntax! What I'm trying to do is get an email from an pop3 account, and then search the email for some CVS data and import that information into MS Access. I'm managed to get some code to download a message from the email account and save it to a text file, does any one have a link to some sample code to search though a file until a string of characters is matched? Or could point me to some functions that may help me with this? I've also managed to connect to my access database, and just print out a field in a table, but I cant find anywhere on the web that will help me to import data? Any help would be great?! By the way I'm running on windows, and have installed the windows add on's. Thanks in advance Mark email code import sys, poplib f = open('c:\\myfile.txt', 'w') mailserver = 'pop3.abilitec.com' mailuser = '[EMAIL PROTECTED]' mailpasswd = '***********' print 'Connecting...' server = poplib.POP3(mailserver) server.user(mailuser) # connect, login to mail server server.pass_(mailpasswd) # pass is a reserved word try: print server.getwelcome() # print returned greeting message msgCount, msgBytes = server.stat() print 'There are', msgCount, 'mail messages in', msgBytes, 'bytes' print server.list() print '-'*80 for i in range(msgCount): hdr, message, octets = server.retr(i+1) # octets is byte count for line in message: # retrieve, print all mail f.write(line) f.write('\n') print '-'*80 # mail box locked till quit if i < msgCount - 1: raw_input('[Press Enter key]') finally: # make sure we unlock mbox server.quit() # else locked till timeout print 'Bye.' f.close() access import sys, win32com.client print 'start' connection = win32com.client.Dispatch(r'ADODB.Connection') DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=c:\\booking.mdb;/root/blackcomb' connection.Open(DSN) recordset = win32com.client.Dispatch(r'ADODB.Recordset') recordset.Open('SELECT * FROM tblBooking', connection, 1, 3) fields_dict = {} for x in range(recordset.Fields.Count): fields_dict[x] = recordset.Fields.Item(x).Name print fields_dict[x], recordset.Fields.Item(x).Value print 'end' -- http://mail.python.org/mailman/listinfo/python-list