Re: SHOCK: WHY None?

2007-09-21 Thread Dave Borne
> else: > f(i+1,sm+a[i]) Maybe because you are ignoring the return value of the when you recurse... try this else: return f(i+1, sm+a[i]) -Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Script that Navigates Page needs Javascript Functionality

2007-08-06 Thread Dave Borne
> in order to view the results I need I need python to "navigate to" > this Javascript link: > javascript:__doPostBack('ctl00$cpMain$pagerTop','4') This basically > translates into "go to page 4." > I read the posts on this group, and from what I understand, the > functionality I need is with simp

Re: smtp server simulation using Python

2007-06-18 Thread Dave Borne
> I have a (web) development computer w/o an SMTP server and want to test > form generated e-mail using a dummy SMTP server that delivers the mail > message to a file, or better yet, to a text editor instead of actually > sending it. Here's a quick and dirty script I use this for email testing pur

Re: IndentationError: unexpected indent

2007-06-16 Thread Dave Borne
> It would be very helpful when Python would warn you when there are tabs in > your source. invoke python with the -t option for warnings about tabs or -tt for errors. -Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: FTP/SSL

2007-06-08 Thread Dave Borne
> I'm trying to figure out how to use FTP/SSL (FTPS) - just as a client. Can I > do this in Python? Is everything I need in ftplib? Where else do I look? And > - any good newbie references on using FTPS? Hi, Nancy, I'm not sure if ftplib can handle ssh or not, but googling for "python sftp" turne

Re: How do I Extract Attachment from Newsgroup Message

2007-05-31 Thread Dave Borne
> I looked for a solution > with mimetools (the way I'd approach it for email) but found nothing. ... > <[EMAIL PROTECTED]>', 'Content-Type: Multipart/Mixed;', ' > boundary="Boundary-00=_A5NJCP3FX6Y5BI3BH890"', 'Date: Thu, ... Playing with data = n.article('116431')[3] and email.mess

Re: HTML Form/Page and Navigation with multiple buttons

2007-05-31 Thread Dave Borne
> How can I identify which button has been pressed. Do I need a > separate form for each button and hide all the relevant session fields > in each form or is there a way of identifying which button has been > pressed on the page. Hi, Richard, Just give each button (or input) tag a distinct name

Re: Why isn't this query working in python?

2007-05-25 Thread Dave Borne
> I'm trying to run the following query: ... > member_id=%s AND expire_date > NOW() AND completed=1 AND (product_id Shouldn't you be using the bind variable '?' instead of '%s' ? (I'm asking because I'm not entirely sure how the execute command is doing the substitution) -Dave -- http://mail.pyt

Re: Multi-Page login WITH Cookies (POST Data)

2007-05-18 Thread Dave Borne
> After we are able to get a succussful login, i need a way that i can browse > my site always including this cookie, like if i went to open up a page, it > would use the cookie we got from logging in. You need something like this: import cookielib,urllib2 cookiejar = cookielib.CookieJar() opener

Re: A best approach to a creating specified http post body

2007-05-18 Thread Dave Borne
> I need to build a special http post body that consists of : > name=value +\r\n strings. > Problem is that depending on operations the number of name,value > pairs can increase and decrease. > Values need to be initialized at runtime, so storing premade text > files is not possible. I'm not comp

Re: How safe is a set of floats?

2007-05-09 Thread Dave Borne
On 4 May 2007 07:21:49 -0700, Thomas Nelson <[EMAIL PROTECTED]> wrote: > I want to generate all the fractions between 1 and limit (with > limit>1) in an orderly fashion, without duplicates. Might I suggest the Stern-Brocot tree (http://en.wikipedia.org/wiki/Stern-Brocot_tree) It will eliminate the

Re: How to replace the last (and only last) character in a string?

2007-05-03 Thread Dave Borne
> Let's suppose > s='12345 4343 454' > How can I replace the last '4' character? If the last '4' will not always be the last character in the string, you could do: 'X'.join(s.rsplit('4',1)) -Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing a nice formatted csv file

2007-05-02 Thread Dave Borne
> Whereas what I'd like to get is: > 1,2,3, > 10, 20, 30 (without trying this myself first...) You might try setting up a csv dialect with a delimiter of ',\t' then using a reader that can set tab stops for display. -Dave -- http://mail.python.org/mailman/listinfo/python-list

Re: Cgi File Upload without Form

2007-04-30 Thread Dave Borne
> Since I want to upload the data programmatically, a form based > solution is not good. Karsten, Could you explain this statement? When I want to move data to a server in a CGI environment, a form post is the easiest way I can think of. What are the specific restrictions making forms a problem?

Re: Reading From an Excel Sheet

2007-04-30 Thread Dave Borne
> I want to write a python script which reads in data from the > excel sheet .Can any one help out in this ...any help will be > appreciated. Try here: http://cheeseshop.python.org/pypi/xlrd/0.5.2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Writing Log CSV (Efficiently)

2007-04-16 Thread Dave Borne
On 4/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Dave> Python has built in logging support. It's pretty flexible as far > Dave> as formatting output. I can get a bit complicated to set up, but > Dave> it will handle traffic well. > > Really? I've found it to be a dog in hea

Re: Writing Log CSV (Efficiently)

2007-04-16 Thread Dave Borne
On 4/16/07, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> wrote: > I'm looking to write a Log file which will be CSV based, and there is a good > possibility that it'll get quite busy once its up and running, so I'm > looking for the most efficient way to achieve it. Whilst I'm sure i could do >

Re: Formatting a string to be a columned block of text

2006-12-26 Thread Dave Borne
Thanks, Paul. I didn't know about textwrap, that's neat. Leon, so in my example change > data1= [testdata[x:x+colwidth] for x in range(0,len(testdata),colwidth)] to > data1 = textwrap.wrap(testdata,colwidth) > data1 = [x.ljust(colwidth) for x in data1] oh and I made a mistake that double spaces i

Re: Formatting a string to be a columned block of text

2006-12-26 Thread Dave Borne
On 26 Dec 2006 04:14:27 -0800, Leon <[EMAIL PROTECTED]> wrote: > I'm creating a python script that can take a string and print it to the > screen as a simple multi-columned block of mono-spaced, unhyphenated > text based on a specified character width and line hight for a column. Hi, Leon, For pu