Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Chris Hengge
I'm not sure what internal blanks means.. but I'll take a stab and say "no", there are going to be NO blanks once I start reading the column unless there are no more values to read... null or "" would be fine for a stopping point. also, what is makepy.py? I'm still working through a couple books

Re: [Tutor] urllib

2006-09-12 Thread Kent Johnson
Patricia wrote: > Hi, > > I have used urllib and urllib2 to post data like the following: > > dict = {} > dict['data'] = info > dict['system'] = aname > > data = urllib.urlencode(dict) > req = urllib2.Request(url) > > And to get the data, I emulated a web page with a submit button: > s =

Re: [Tutor] urllib

2006-09-12 Thread N
Hi,   You can try this:   import httplib, urllib params = urllib.urlencode({'ID':'1','Name':'name', 'Eid':'we[at]you.com'}) #Assumed URL: test.com/cgi-bin/myform h = httplib.HTTP("test.com")h.putrequest("POST", "/cgi-bin/myform")h.putheader("Content-length", "%d" % len(params))h.putheader('A

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Etrade Griffiths
Chris are you looking for something like this? xlSht=xlApp.Worksheets("Sheet1") irow=1 XL_row_has_data=1 while XL_row_has_data: xlRng=xlSht.Range(xlSht.Cells(irow,1),xlSht.Cells(irow,256)) ncell=xlApp.WorksheetFunction.CountA(xlRng) if ncell ==0: # Cells in current row

[Tutor] Help needed for etherealXML parsing

2006-09-12 Thread Akanksha Govil
Hi,I have downloaded an add on python script "etherealXML.py" for parsing the ethereal captured packets.This script runs fine on python 2.3 but on python 2.4 it gives error.Has any one tried porting this script?Also I found the SAX parser earlier used to return a call back function which is no long

Re: [Tutor] Help needed for etherealXML parsing

2006-09-12 Thread Kent Johnson
Akanksha Govil wrote: > Hi, > > I have downloaded an add on python script "etherealXML.py" for parsing > the ethereal captured packets. > > This script runs fine on python 2.3 but on python 2.4 it gives error.\ What is the error? > > Has any one tried porting this script? This might give a c

[Tutor] HTML page status

2006-09-12 Thread Johan Geldenhuys
Hi all, I looked a little bit at the urllib and it all looks fairly easy. What I didn't see, if it is there, was how to know or identify if a page was successfully downloaded. I want to do tests to see if a connection to a webpage was successful by parsing whatever came back. Will this be the

[Tutor] HTML page status

2006-09-12 Thread Johan Geldenhuys
Hi all, I looked a little bit at the urllib and it all looks fairly easy. What I didn't see, if it is there, was how to know or identify if a page was successfully downloaded. I want to do tests to see if a connection to a webpage was successful by parsing whatever came back. Will this be the e

Re: [Tutor] HTML page status

2006-09-12 Thread Luke Paireepinart
Johan Geldenhuys wrote: > Hi all, > > I looked a little bit at the urllib and it all looks fairly easy. > What I didn't see, if it is there, was how to know or identify if a page > was successfully downloaded. I want to do tests to see if a connection > to a webpage was successful by parsing what

Re: [Tutor] foreach loops

2006-09-12 Thread Alan Gauld
> Does python have foreach loops? I don't see any > mention of them in the docs. Am I going to have to > use Perl (gasp!) if I want my beloved foreach loop? Its called a for loop in Python... Or is there some extra magic in the Perl version that I'm missing? Alan G. ___

Re: [Tutor] foreach loops

2006-09-12 Thread Alan Gauld
> I was thinking more along the lines of this: > > A C++ for loop: This is exactly NOT a foreach loop, its a vanilla for loop. > > #include > > using std::cout; > > int main() { > > for (int i = 0; i < 10; i++) { > cout << i << "\n"; > } for i in range(10): print i Alan G. ___

Re: [Tutor] HTML page status

2006-09-12 Thread Michael P. Reilly
On 9/12/06, Johan Geldenhuys <[EMAIL PROTECTED]> wrote: Hi all,I looked a little bit at the urllib and it all looks fairly easy.What I didn't see, if it is there, was how to know or identify if a pagewas successfully downloaded. I want to do tests to see if a connection to a webpage was successful

Re: [Tutor] HTML page status

2006-09-12 Thread Johan Geldenhuys
I don't know if this will work in all cases. I tried it with a internet connection and could get a 'OK' response. Then I tried it withoput a internet connection and received a Traceback error, which is not what I want. It gave me some idea what is possible. Johan Michael P. Reilly wrote: On

Re: [Tutor] man pages parsing (still)

2006-09-12 Thread Tiago Saboga
Em Segunda 11 Setembro 2006 19:45, Kent Johnson escreveu: > Tiago Saboga wrote: > > Ok, the guilty line (279) has a "©" that was probably defined in the > > dtd, but as it doesn't know what is the right dtd... But wait... How does > > python read the dtd? It fetches it from the net? I tried it > >

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread John Fouhy
On 12/09/06, Chris Hengge <[EMAIL PROTECTED]> wrote: > I'm not sure what internal blanks means.. but I'll take a stab and say > "no", there are going to be NO blanks once I start reading the column > unless there are no more values to read... null or "" would be fine for > a stopping point. Well,

Re: [Tutor] HTML page status

2006-09-12 Thread Kent Johnson
Johan Geldenhuys wrote: > I don't know if this will work in all cases. I tried it with a > internet connection and could get a 'OK' response. Then I tried it > withoput a internet connection and received a Traceback error, which is > not what I want. > > It gave me some idea what is possible.

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Chris Hengge
I got it working!   try:#Attempt to record the fields from the excel file.    row = 10 #Set the row in excel.    #While the cell isn't 'None', keep looping.    #Excel (row,col) for navigation    while xlSht.Cells(row,1).Value != None:     print >> file, "'%s'," % xlSht.Cells(row,1).Value,  

Re: [Tutor] Traversing Excel Columns

2006-09-12 Thread Alan Gauld
> I can get file.write("'%s',") % xlSht.Cells(row,1).Value > to work.. file.write("'%s'," % xlSht.Cells(row,1).Value) Try that The string formatting must happen inside the parens. BTW using 'file' as a variab;e is not good since file is a built-in function name (albeit an alias for o