Re: [Tutor] Confused about embedding python in Html

2005-08-20 Thread Adam Cripps
On 8/21/05, Tony Cappellini <[EMAIL PROTECTED]> wrote: > > > I want to use embedded python in an html page. > However, I dont want to force the user to have python installed for the > page to work. > Is there any way to make the embedded python code be executed by the server? > > I'm hoping ti u

[Tutor] Confused about embedding python in Html

2005-08-20 Thread Tony Cappellini
I want to use embedded python in an html page. However, I dont want to force the user to have python installed for the page to work. Is there any way to make the embedded python code be executed by the server? I'm hoping ti use python as an alternative to vbscript and jaava thanks tony ___

Re: [Tutor] String formatting

2005-08-20 Thread Kent Johnson
Ah, thanks for the explanation. I've never been tripped up by that... Kent Pierre Barbier de Reuille wrote: > Kent Johnson a écrit : > >>Pierre Barbier de Reuille wrote: >> > > [...] > >> >>>Well, when using the "%" operator on string always put a tuple or a >>>dictionnary on the RHS : >>> >>>

Re: [Tutor] Strange "snippets" in Learning Python, 2nd ed.

2005-08-20 Thread Kent Johnson
Dick Moores wrote: > I have the first printing. The snippets are on pp. 159 and 160, and are > there to illustrate the loop "else" clause. > > found = 0 > while x and not found: > if match(x[0]): # value at front? > print 'Ni' > found = 1 > else: >

Re: [Tutor] Strange "snippets" in Learning Python, 2nd ed.

2005-08-20 Thread Andrei
Dick Moores wrote: > I have the first printing. The snippets are on pp. 159 and 160, and are > there to illustrate the loop "else" clause. > while x: # exit when x empty > if match(x[0]): > print 'Ni' > break# exit, go around else

Re: [Tutor] os.access vs os.path.isfile

2005-08-20 Thread Danny Yoo
> os.access is better/fast that os.path.isfile for checking if exist a file? I don't think we should judge this primarily as a matter of speed, but a matter of functionality. If we do something like: os.access(pathname, os.F_OK) this will tell us if a path name exists. But note that this

[Tutor] os.access vs os.path.isfile

2005-08-20 Thread Jonas Melian
os.access is better/fast that os.path.isfile for checking if exist a file? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] String formatting

2005-08-20 Thread Pierre Barbier de Reuille
Kent Johnson a écrit : > Pierre Barbier de Reuille wrote: > [...] > > >>Well, when using the "%" operator on string always put a tuple or a >>dictionnary on the RHS : >> >>print "Connection from %s" % (info,) > > > No, you can put a single item on the right without putting it in a tuple: > >>

[Tutor] Strange "snippets" in Learning Python, 2nd ed.

2005-08-20 Thread Dick Moores
I have the first printing. The snippets are on pp. 159 and 160, and are there to illustrate the loop "else" clause. found = 0 while x and not found: if match(x[0]): # value at front? print 'Ni' found = 1 else: x = x[1:]# slice off

Re: [Tutor] String formatting

2005-08-20 Thread Kent Johnson
Pierre Barbier de Reuille wrote: > Jorge Louis De Castro a écrit : > >>Hi, >> >>I'm slighty confused with python's string formatting operators. >> >>Why is it that this prints as a string: >> >>channel, info = server.accept() >>print "Connection from", info >> >>And this doesn't? >> >>channel, inf

Re: [Tutor] String formatting

2005-08-20 Thread Pierre Barbier de Reuille
Jorge Louis De Castro a écrit : > Hi, > > I'm slighty confused with python's string formatting operators. > > Why is it that this prints as a string: > > channel, info = server.accept() > print "Connection from", info > > And this doesn't? > > channel, info = server.accept() > print "Connecti

[Tutor] String formatting

2005-08-20 Thread Jorge Louis De Castro
Hi,   I'm slighty confused with python's string formatting operators.   Why is it that this prints as a string:   channel, info = server.accept() print "Connection from", info   And this doesn't?   channel, info = server.accept() print "Connection from %s" % info   Also, anyone knows how do

Re: [Tutor] Searching Sorted Lists

2005-08-20 Thread Andrei
[EMAIL PROTECTED] wrote: > Hi, Can someone tell me if there is a bulit in Binary search function for > python lists ? > > I am currently building lists and sorting them with a comparison function. > The only list search function I know is List.Index(X), which is pretty > inefficient I reckon, espe

Re: [Tutor] Searching Sorted Lists

2005-08-20 Thread Alan G
> The only list search function I know is List.Index(X), which is > pretty > inefficient I reckon, especially hen the lists are likely to contain > 100's > or 100's of members. Have you tried it? How long is it taking? I'd be very surprised if it there was a serious problem indexing a list of ev

Re: [Tutor] How do you turn something into a number?

2005-08-20 Thread Alan Gauld
> I have what I think is a string from socket.recvfrom(...). > I want to turn it into numbers so I tried: > data, address = recvfrom (...stuff...) > s = "" This reads a sequence of bytes from the socket. What those bytes represents only you can know. If they are a sequence of ascii codes then th