[Tutor] Use of dictionary or DBM instead of spreadsheet

stuart_clemons@us.ibm.com stuart_clemons@us.ibm.com
Tue, 4 Jun 2002 14:59:47 -0400


--0__=0ABBE15DDFFBBF288f9e8a93df938690918c0ABBE15DDFFBBF28
Content-type: text/plain; charset=US-ASCII


Hi all:

I have an WinNT application I run that consists of three phases, 1) Python,
2) spreadsheet, and 3) Python.   I would like to eliminate the spreadsheet
and make this an all Python application.

Here's the details.

1) I run a python program that "pings" a list of IP addresses and
determines if the IP addresses are being used.  I run this daily.  The
result is collected daily in a text file called ipresult.txt, which looks
like this:

      9.99.99.1 noreply
      9.99.99.2 reply
      9.99.99.3 reply
      9.99.99.4 noreply, etc.

2) I then import this file daily into a spreadsheet which is acting as a
collection repository.  The spreadsheet file looks like this, with column
entries for each day's results.

            6/1         6/2         6/3         6/4
      9.99.9.1    noreply           reply       reply       reply
      9.99.9.2    reply       reply       reply       reply
      9.99.9.3    reply       noreply           reply       reply
      9.99.9.4    noreply           noreply           noreply
noreply

3) I then export this file into a text file that looks like the above, only
it's a text file.  I then run another Python program that will print out
only those IP address that have only no reply's.  In the above example, the
IP address 9.99.9.4 is the only IP address that has not had a reply.

I would like to eliminate using the spreadsheet as the data repository and
make this all python.  I was thinking I could use either a dictionary or
the anydbm module to act as the collection repository instead of the
spreadsheet, but I don't know how to do it.   My Python reference books
only touch on dictionaries and the anydbm module.   I ruled out appending
to a file, since it would not allow for columns of data.

I guess I need to know how to add data to the repository and then how to
check the entries for each IP address in the repository.

Any guidance would be greatly appreciated.

- Stuart

--0__=0ABBE15DDFFBBF288f9e8a93df938690918c0ABBE15DDFFBBF28
Content-type: text/html; charset=US-ASCII
Content-Disposition: inline

<html><body>
<p>Hi all:<br>
<br>
I have an WinNT application I run that consists of three phases, 1) Python, 2) spreadsheet, and 3) Python.   I would like to eliminate the spreadsheet and make this an all Python application.<br>
<br>
Here's the details.  <br>
<br>
1) I run a python program that &quot;pings&quot; a list of IP addresses and determines if the IP addresses are being used.  I run this daily.  The result is collected daily in a text file called ipresult.txt, which looks like this:<br>
<br>
	9.99.99.1 noreply<br>
	9.99.99.2 reply<br>
	9.99.99.3 reply<br>
	9.99.99.4 noreply, etc.<br>
<br>
2) I then import this file daily into a spreadsheet which is acting as a collection repository.  The spreadsheet file looks like this, with column entries for each day's results.<br>
<br>
		6/1		6/2		6/3		6/4<br>
	9.99.9.1	noreply		reply		reply		reply<br>
	9.99.9.2	reply		reply		reply		reply<br>
	9.99.9.3	reply		noreply		reply		reply<br>
	9.99.9.4	noreply		noreply		noreply		noreply<br>
<br>
3) I then export this file into a text file that looks like the above, only it's a text file.  I then run another Python program that will print out only those IP address that have only no reply's.  In the above example, the IP address 9.99.9.4 is the only IP address that has not had a reply.<br>
<br>
I would like to eliminate using the spreadsheet as the data repository and make this all python.  I was thinking I could use either a dictionary or the anydbm module to act as the collection repository instead of the spreadsheet, but I don't know how to do it.   My Python reference books only touch on dictionaries and the anydbm module.   I ruled out appending to a file, since it would not allow for columns of data.  <br>
<br>
I guess I need to know how to add data to the repository and then how to check the entries for each IP address in the repository.  <br>
<br>
Any guidance would be greatly appreciated.<br>
<br>
- Stuart <br>
<br>
</body></html>
--0__=0ABBE15DDFFBBF288f9e8a93df938690918c0ABBE15DDFFBBF28--