Dj Gilcrease wrote:
The simple answer is to just use chr(int(inNum))
though here is how I would do it
def convert_string_to_int(strInt):
try:
return int(strInt)
except ValueError:
return 0
def getNumbers(output):
inNum = raw_input("Please enter an ASCII number\n(33
I'm not sure what you mean, "What directory do you run from?". I have
the file saved as C:\cgihome\cgi\cgitest.py and I try running it by
typing the following in the URL field:
http://localhost:8000/cgi/cgitest.py . I tried changing the folder name
to cgi-bin and get the same error. It says, "N
Hi!
I am teaching myself Python using John Zelle's excellent book Python
Programming (ISBN: 1-887902-99-6). At the end of Chapter 4 - Computing
with Strings is an exercise to convert an existing program to use a list
to decode ASCII number input. My solution is shown below.
My problem is wit
On Thu, Oct 30, 2008 at 9:41 PM, <[EMAIL PROTECTED]> wrote:
>
> I followed the instructions on a tutorial and created a "C:\cgihome" server,
> and then
> created the following file:
>
> C:\cgihome\server\cgihttpserver.py
>
> It contains the following code:
> [CODE]
> import CGIHTTPServer
> import
On Thu, Oct 30, 2008 at 4:55 PM, Shawn Milochik <[EMAIL PROTECTED]> wrote:
> I just ran a very crude test.
>
> Results: Lists load more quickly but iterate more slowly. Dictionaries
> take longer to load but iteration takes about half the time.
Here are my results using timeit and Python 2.6:
I
Hi everyone,
I am new to programming and have been programming with Python for
about 2.5 months. After learning the basics of the language I am
trying to teach myself CGI with Python. I've
come across a few resources that teach CGI, but I am having much
trouble setting up a
server to view CGI sc
2008/10/31 <[EMAIL PROTECTED]>:
> Hi tutors.
>
> Is there a way to remap a tab key to enter a user-specified number of spaces
> in a Tkinter text widget instead of a genuine tab? An internet search has
> turned up zilch. The tab option in a text widget lets you enter the number of
> centimeters
Hi tutors.
Is there a way to remap a tab key to enter a user-specified number of spaces in
a Tkinter text widget instead of a genuine tab? An internet search has turned
up zilch. The tab option in a text widget lets you enter the number of
centimeters to space over, but this option is truly use
Hello Dinesh!
On Thursday 30 October 2008, Dinesh B Vadhia wrote:
> Bob: Nothing special is being done on the elements of the list -
> additions/subtractions/ - and storing the results in an array.
> That's it.
You could convert the list into a numpy array first, and you could try
to express th
> They seem pretty similar. Here are two tests (code follows). Perhaps I
> could have loaded them differently and it would have made more of a
> difference. In this case I just made a list and populated the sets
> from it.
>
> Results for 999 iterations:
>Set:
>Load: 1.2
Thanks Wesley
I use both dictionaries (especially defaultdict) and sets all the time but for
this particular problem I need the dictionary or set (preferably) to be ordered
ie. the set contains integers, which don't change, but they have to be ordered
- low to high - when read back with a for-l
> Unless my eyes are squiffy the 2nd dictionary of sets
> appears ordered. I've run it with other numbers > 25
> and continue to get ordered sets but anything < 25
> results in unordered sets. A feature or a bug?
No, not a feature or a bug... it would be a bug to assume
the elements will be in o
On Thu, Oct 30, 2008 at 6:06 PM, wesley chun <[EMAIL PROTECTED]> wrote:
> based on the all the performance questions, i would say agree that
> dictionary access is faster than lists (hashes exist cuz they're fast)
> but they use up more memory, as shown in shawn's numbers. also, one of
> the reason
based on the all the performance questions, i would say agree that
dictionary access is faster than lists (hashes exist cuz they're fast)
but they use up more memory, as shown in shawn's numbers. also, one of
the reasons why slots was added to classes was because the attribute
dictionary began to i
Here is an interesting result with defaultdict(set). This program creates 2
dictionaries of sets with the first dictionary containing 10 elements per set
and the second containing 25 elements. You'll see the sets in the first
dictionary are unordered and in the second they are ordered.
impor
On Thu, Oct 30, 2008 at 4:05 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 30, 2008 at 2:46 PM, Shawn Milochik <[EMAIL PROTECTED]> wrote:
>
>> You might try using dictionaries instead. I've had phenomenal speed
>> gains by switching lists to dictionaries before, although that may
>> hav
On Thu, Oct 30, 2008 at 4:09 PM, spir <[EMAIL PROTECTED]> wrote:
> Well, would someone clarify the point about decorators? Rather the point of
> having both a built-in function (introduced in python 2.2, as I just read)
> and a "decorator" (2.4) for a single use of declaring a method
> not_to_be_b
Hello again,
I just tried with the classmethod() built_in function. Well, this is
exactly what I was looking for. It supplies a way of defining type_level
methods -- what was missing before.
[I still think this is a workaround: we would not need this if the
syntax was the same for methods and
[forwarded, only A.T.Hofkamp got this answer]
A.T.Hofkamp a écrit :
spir wrote:
Q: Is there a way to write /type/ (class) functions, meaning methods
not bound to an instance, in python?
As Bob Gailer already said, staticmethod seems to do what you want.
Thank you for you answers about static
On Thu, Oct 30, 2008 at 2:46 PM, Shawn Milochik <[EMAIL PROTECTED]> wrote:
> You might try using dictionaries instead. I've had phenomenal speed
> gains by switching lists to dictionaries before, although that may
> have had more to do with the fact that I needed to access certain
> values, rather
On Thu, Oct 30, 2008 at 2:36 PM, Dinesh B Vadhia
<[EMAIL PROTECTED]> wrote:
> I need to process a large number (> 20,000) of long and variable length
> lists (> 5,000 elements) ie.
>
> for element in long_list:
> # the result of this operation is not
> a list
>
> The performance is reas
Bob: Nothing special is being done on the elements of the list -
additions/subtractions/ - and storing the results in an array. That's it.
Dinesh
From: bob gailer
Sent: Thursday, October 30, 2008 11:40 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] fast list traversal
D
On Thu, Oct 30, 2008 at 2:40 PM, bob gailer <[EMAIL PROTECTED]> wrote:
> Dinesh B Vadhia wrote:
>>
>> I need to process a large number (> 20,000) of long and variable length
>> lists (> 5,000 elements) ie.
>> for element in long_list:
>># the result of this operation is
>> not a list
>
Dinesh B Vadhia wrote:
I need to process a large number (> 20,000) of long and variable
length lists (> 5,000 elements) ie.
for element in long_list:
# the result of this operation
is not a list
The performance is reasonable but I wonder if there are faster Python
methods?
I d
I need to process a large number (> 20,000) of long and variable length lists
(> 5,000 elements) ie.
for element in long_list:
# the result of this operation is not a
list
The performance is reasonable but I wonder if there are faster Python methods?
Dinesh
Seems like when they press "op" you assume that the current number is
done being executed and save the value. Then when they press another
op, you evaluate the previous op with the new value. You don't update
the display until they start typing again.
However, when they press =, you evaluate the
Hi, I'm trying to teach myself Tkinter by making a desktop calculator.
I've got the Tkinter bit working, but getting the output to work how I
want it to is causing serious brainfreeze...
The buttons 0 through 9 and '.' all append to a queue, which
makeNumber(queue) returns as an actual python nu
spir wrote:
Q: Is there a way to write /type/ (class) functions, meaning methods not
bound to an instance, in python?
As Bob Gailer already said, staticmethod seems to do what you want.
After reading your mail, I cannot help wondering that something crucial seems
to be missing in your class s
spir wrote:
Hello,
New to the list. I'm a self-taught, amateur programmer. Also,
non-native english speaker -- so, don't be surprised with weird
expression.
Q: Is there a way to write /type/ (class) functions, meaning methods
not bound to an instance, in python?
Take a look at the built-i
Hello,
New to the list. I'm a self-taught, amateur programmer. Also, non-native
english speaker -- so, don't be surprised with weird expression.
Q: Is there a way to write /type/ (class) functions, meaning methods not
bound to an instance, in python?
Context: I'm developping an application
30 matches
Mail list logo