Re: [Tutor] Dictionary Inserts...

2005-05-05 Thread Eric Culpepper

Here's some quick examples:
 dictMe = {}
 dictMe['SomeKey'] = 'SomeValue'
 dictMe
{'SomeKey': 'SomeValue'}
 dictMe[1] = 100
 dictMe
{1: 100, 'SomeKey': 'SomeValue'}
 type(dictMe)
type 'dict'

Section 5.5 of the Python tutorial covers dictionaries a little more in depth.
http://docs.python.org/tut/node7.html



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Allen John Schmidt, Jr.
Sent: Thursday, May 05, 2005 10:37 AM
To: tutor@python.org
Subject: [Tutor] Dictionary Inserts...


Ok, I have had enough. I have looked all through the python docs and I 
cannot find it. How do you insert an entry into a dictionary?

Thanx!
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


RE: [Tutor] getting a webpage via python

2005-03-08 Thread Eric Culpepper

You could use the builtin modules like urllib2, httplib, or you could use John 
Lee's spifftastic module mechanize. I use mechanize a lot for automating 
downloading files from various partner websites my company has relations with.

http://docs.python.org/lib/module-httplib.html
http://docs.python.org/lib/module-urllib2.html
http://wwwsearch.sourceforge.net/mechanize/

Good luck.

Eric Culpepper
[EMAIL PROTECTED] 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Paul Tremblay
Sent: Tuesday, March 08, 2005 10:21 AM
To: python tutor
Subject: [Tutor] getting a webpage via python


Is there a simple way to get a web page with python? I have done no
network programming with python before. 

My router (a Linksys 54G model) stores the IP/MAC addresss in a web
page. There is no way for me to access them except through the web. 

Righ now, I am using this code:

command = 'lynx -reload -auth %s:%s -source http://%s/DHCPTable.asp  %s' % (
 self.__log_name, self.__log_password, self.__router_address, 
temp_out1)
(exit_status, out_text) = commands.getstatusoutput(command)

The lynx terminal browser dumps the raw HTML page to the out_text, and I
can then parse it.

I would like to make the code independent of lynx, if possible.

Thanks

Paul

-- 


*Paul Tremblay *
[EMAIL PROTECTED]*

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


RE: [Tutor] Acessing files in Windows 2000

2005-03-08 Thread Eric Culpepper

Try something like this (change the username to the user you're logged in as, 
or Administrator if that's how you're logged in):

c:\\documents and settings\\username|Administrator\\my documents\\memo.txt


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Dave S
Sent: Tuesday, March 08, 2005 4:24 PM
To: Python Tutor
Subject: [Tutor] Acessing files in Windows 2000


I have a script that converts data relating to my work.

It works great on my Linux system but some of my colleagues run windows. 
I am attempting to convert the file paths to windows but am having no luck.

I need to access 'memo.txt' in 'my documents' on windows  am struggling.
I have tried just about every combination of \ and / and \\ and // but 
to no avail.
I need something like ...

C:\My Documents\memo.txt

Can anyone advise me ?

Dave


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor