Re: [Tutor] Is anybody out there who could help me with URL Authentication?

2008-08-01 Thread Jeff Younker
On Aug 1, 2008, at 12:39 AM, Federo wrote: Below is problem I am unable to solve. I would appreciate your advice or even better code sample. The problem is URL authorisation. I try to approaches but no luck so far. Two problems: 1.) Being able to logon using Python code 2.) Being able to s

[Tutor] Scan Directory for files

2008-08-01 Thread Fred @ Mac
Hello, new to python, so please go easy on me! I am using for f in os.listdir(watch_dir): tree = ET.parse(f) for shot in tree.findall('Shot'): ..do stuff.. to scan a directory for specific files (xml files specifically). But my script fails if, for example, a d

Re: [Tutor] Logging In To Forum

2008-08-01 Thread Alex Krycek
Kent, I tried reading several pages with the read() function. Unfortunately nothing changed. I'll take a look at Firebug. Thanks. On Fri, Aug 1, 2008 at 1:20 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Fri, Aug 1, 2008 at 2:47 PM, Alex Krycek <[EMAIL PROTECTED]> > wrote: > > Hello, > > > >

Re: [Tutor] Logging In To Forum

2008-08-01 Thread Kent Johnson
On Fri, Aug 1, 2008 at 2:47 PM, Alex Krycek <[EMAIL PROTECTED]> wrote: > Hello, > > I would like to have my script log in to a vBulletin forum. My script does > seem to do this (as I can check my control panel, etc.). But although I can > get access to my account, the forum fails to update the date

[Tutor] Logging In To Forum

2008-08-01 Thread Alex Krycek
Hello, I would like to have my script log in to a vBulletin forum. My script does seem to do this (as I can check my control panel, etc.). But although I can get access to my account, the forum fails to update the date when I last visited. That date updates just fine when I do it manually through

Re: [Tutor] Is anybody out there who could help me with URL Authentication?

2008-08-01 Thread Monika Jisswel
Here is some code, it will help you manage cookies, & stay logged in to the website for further queries. import os, sys, time, urllib, urllib2, cookielib, re > > cj=cookielib.LWPCookieJar() > headers={'User-Agent' : user_agent} > opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) > urlli

Re: [Tutor] Tutor Newbie

2008-08-01 Thread Monika Jisswel
it would take learning to use some of the modules that help create GUIs. they are : wx and Tkinter 2008/7/25 Sam Last Name <[EMAIL PROTECTED]> > Hey guys, need some info on "programs" :) > > > Heres a Very simple Script that works with basically any numbers. > > > width = input("What is the Width

Re: [Tutor] Newbie

2008-08-01 Thread Monika Jisswel
if you remove the comma after the print i for i in range(10) : print i print "Goodbye World!" your problem will be solved, the comma in a print statement means ' ' or space. THREADING is a word that means something else than having two strings on the same line. 2008/7/23 Sam Last Name <

Re: [Tutor] Unzipping a list

2008-08-01 Thread Monika Jisswel
> > >>> answers= ['ask','tell','repeat','sell'] > >>> > >>> > >>> a = '/usr/program/bin -o '+ ' '.join(answers) > >>> print a > /usr/program/bin -o ask tell repeat sell > 2008/7/8 Faheem <[EMAIL PROTECTED]>: > Hey all, > > If anyone is interested I found this while googling > > answers= ['ask'.'t

Re: [Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Monika Jisswel
2008/8/1 Angela Yang <[EMAIL PROTECTED]> > > > collection = [] > collection['abby'].append('apprentice1') > collection['abby'].append('apprentice2') > > That did not work because list index is not numeric. > But for dictionaries, it is key - value pairs. But I need key -> multiple > values. > > D

Re: [Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Kent Johnson
On Thu, Jul 31, 2008 at 11:16 PM, Angela Yang <[EMAIL PROTECTED]> wrote: > Hi, > > I have a list of values for one key. How do I specify this data structure? > > First tried, > > collection = [] > collection['abby'].append('apprentice1') > collection['abby'].append('apprentice2') > > That did not

Re: [Tutor] Is anybody out there who could help me with URL Authentication?

2008-08-01 Thread Kent Johnson
On Fri, Aug 1, 2008 at 3:39 AM, Federo <[EMAIL PROTECTED]> wrote: > Hi .. > > I have to admit that Python is really surprising me. It was lucky day a few > weeks ago I firts time start using Python. Lot's of things realy can be done > with short learning curve. Your user guieds was best place to st

Re: [Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Benoit Thiell
Dear Angela, in order to do this, the setdefault function of the dictionaries is very useful. For example: mydict = {} mylist = mydict.setdefault(mykey, []) mylist.append(myvalue) "setdefault" either returns the already existing list or sets a new list for the key and returns it. Regards,

Re: [Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Alan Gauld
"Angela Yang" <[EMAIL PROTECTED]> wrote But for dictionaries, it is key - value pairs. But I need key -> multiple values. But a value can be a list. d = {} d['odd'] = [1,3,5,7] d['even'] = [2,4,6,8] print d['odd'][2]# = 5 See the Raw Materials top[ic in my tutorial for another example

Re: [Tutor] __getattribute__ instead of Mixing in and Mixing out classes in python

2008-08-01 Thread Tomaz Bevec
Thanks for your suggestion, Kent. I've looked into it a little bit and I think its probably the right way to go. --- On Thu, 7/31/08, Kent Johnson <[EMAIL PROTECTED]> wrote: > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Mixing in and Mixing out classes in python > To: [EMAI

Re: [Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Marc Tompkins
On Thu, Jul 31, 2008 at 8:16 PM, Angela Yang <[EMAIL PROTECTED]> wrote: > Hi, > > I have a list of values for one key. How do I specify this data structure? > > First tried, > > collection = [] > collection['abby'].append('apprentice1') > collection['abby'].append('apprentice2') > > That did not

Re: [Tutor] Mixing in and Mixing out classes in python

2008-08-01 Thread Alan Gauld
"Tomaz Bevec" <[EMAIL PROTECTED]> wrote I'm working on a simulation of cellular growth patterns ...and cells can potentially gain and lose these "behaviors" over the course of the simulation. OK, That might be a valid scenario. But personally I'd probably implement that as an attribute of the

[Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Angela Yang
Hi, I have a list of values for one key.  How do I specify this data structure? First tried, collection = [] collection['abby'].append('apprentice1') collection['abby'].append('apprentice2') That did not work because list index is not numeric. But for dictionaries, it is key - value