Searching for txt file and importing to ms access
mline at abilitec.com
Fri Oct 21 10:09:42 CEST 2005
Once i have this working i was planing to kept all the txt files as logs,
i'd have to give them a real name and stuff.
But thanks for you help so far
"Mike Meyer" <mwm at mired.org> wrote in message
news:86br1kunnd.fsf at bhuda.mired.org...
> "Mark Line" <mline at abilitec.com> writes:
>> 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
>> search though a file until a string of characters is matched? Or could
>> point me to some functions that may help me with this?
> datafile = open("c:\\myfile.txt", "r")
> data = datafile.read()
> start = data.index(myindicator)
> will leave start as the index in data where the the string in
> myindicator first appears. If you want the end of myendicator, use
> start = data.find(myindicator) + len(myindicator).
> Have you considered not saving the message to disk? You can manipulate
> it all in memory.
>> 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
>> import data? Any help would be great?!
> Can't help with that. The phrase "win32com" comes to mind, but I'm not
> a windows person.
> Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
> Independent WWW/Perforce/FreeBSD/Unix consultant, email for more
More information about the Python-list