Hi All,
is it any easy way to mesaure a windows software response time from python
script ?
I think about a small python script that can open a win32 application,
insert a new order with sendkey, deliver the goods, do other things and
create a small log file with the different split times.
I w
How does one go about creating functions, classes, or callable objects
when you don't know their name in advance? (For example you want to
read their names in from a text file or database).
I want to use this in a few different places. For example Faces, the
Python Project Management Planner Tool
I am just learning python, or trying to, and am having trouble handling utf-8
text.
I want to take a utf-8 encoded web page, and feed it to Beautiful Soup
(http://crummy.com/software/BeautifulSoup/).
BeautifulSoup uses SGMLParser to parse text.
But although I am able to read the utf-8 encoded Jap
On Fri, 10 Mar 2006 08:55:35 +0100
Ferry Dave Jäckel <[EMAIL PROTECTED]> wrote:
> Hello list,
>
> I try hard to understand python and unicode support, but don't get it
> really.
>
> What I thought about this until yesterday :)
> If I write my script in unicode encoding and put the magic # -*- c
Ferry Dave Jäckel wrote:
> Hello list,
>
> I try hard to understand python and unicode support, but don't get it
> really.
>
> What I thought about this until yesterday :)
> If I write my script in unicode encoding and put the magic # -*- coding:
> utf-8 -*- at its start, I can just use unicode
Ed Singleton wrote:
> How does one go about creating functions, classes, or callable objects
> when you don't know their name in advance? (For example you want to
> read their names in from a text file or database).
>
> I want to use this in a few different places. For example Faces, the
> Python
> How does one go about creating functions, classes, or callable objects
> when you don't know their name in advance? (For example you want to
> read their names in from a text file or database).
First point, names of functions are no different to names of other things.
def f(x):
y = blah
Ryan Ginstrom wrote:
> I am just learning python, or trying to, and am having trouble handling utf-8
> text.
>
> I want to take a utf-8 encoded web page, and feed it to Beautiful Soup
> (http://crummy.com/software/BeautifulSoup/).
> BeautifulSoup uses SGMLParser to parse text.
>
> But although I
Basically, I have a code with is almost finished but I've having difficultly
with the last stage of the process. I have a program that gets assigns
different words with a different value via looking them up in a dictionary:
eg if THE is in the writing, it assigns 0.965
and once the whole passag
I see that one way to use *arg in a function is to simply pass them on to
another function that perhaps will unpack the arguments:
###
def pass_along(func, *args):
return func(*args)
def adder(x,y):
return x+y
def suber(x,y):
return x-y
print pass_along(adder,1,2)
print pass_along(su
Hi,
> However, I can't seem to get the program to treat the numbers as numbers. If
> I put them in the dictionary as 'THE' = int(0.965) the program returns 1.0
> and if I put 'THE' = float(0.965) it returns 0.9655549 or something
> similar. Neither of these are right! I basically need to acce
On 3/10/06, sjw28 <[EMAIL PROTECTED]> wrote:
Basically, I have a code with is almost finished but I've having difficultlywith the last stage of the process. I have a program that gets assignsdifferent words with a different value via looking them up in a dictionary:
eg if THE is in the writing, it
Hi,Could you please explain this code?.f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1Thanks,-- Edgar A. Rodriguez V.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Fri, 10 Mar 2006, [ISO-8859-1] J�nos Juh�sz wrote:
> is it any easy way to mesaure a windows software response time from python
> script ?
> I think about a small python script that can open a win32 application,
> insert a new order with sendkey, deliver the goods, do other things and
> c
> I want to use this in a few different places. For example Faces, the
> Python Project Management Planner Tool Thingy, uses nested functions to
> put tasks within a project:
>
> def MyProject():
> start = "2006-03-06"
> resource = Me
>
> def Task1():
> start = "2006-03-13"
>
>
On 3/10/06, Edgar Antonio Rodriguez Velazco <[EMAIL PROTECTED]> wrote:
Hi,Could you please explain this code?.f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
This is why lambdas are evil. Officially, they are for creating
"anonymous functions"; usually they only succeed in creating obscure
unreadabl
> Am I missing some other usage where you wouldn't want to unpack the
> *arg? If not, would the following "behind the scenes" behavior be
> possible/preferred?
>
> ###
> def foo(*arg):
> pass
> ###
>
> automatically does this
>
> ###
> def foo(*arg):
> if len(arg) == 1:
> arg = arg[
On Fri, 10 Mar 2006, Edgar Antonio Rodriguez Velazco wrote:
> Could you please explain this code?.
>
> f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
Hi Edgar,
This is terrible code. *grin*
I know that this is the factorial function in disguise, but this is just
Wrong. I don't think we sho
> The expression n-1 + abs(n-1) is always a true value... except in the
> case where n is zero.
Sorry, that's wrong of me, but you know what I mean. *grin*
It zeros out when n-1 <= 0, that is, when n <= 1.
##
>>> def test(n):
... return n-1 + abs(n-1)
...
>>> for x in range(-5, 5):
...
On Fri, 10 Mar 2006, Danny Yoo wrote:
> > The expression n-1 + abs(n-1) is always a true value... except in the
> > case where n is zero.
>
> Sorry, that's wrong of me, but you know what I mean. *grin*
Ugh, the other thing I screwed up wrong was misreading:
X and Y or Z
and forgetting my
Dnia piątek, 10 marca 2006 19:31, Edgar Antonio Rodriguez Velazco napisał:
> f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
Oh God! This smells lispish! Haven't seen a jevel like this before, but I LOVE
it!
-
First, let's cut that into pieces:
R1 n-
Does Python support the Unicode-flavored class-specifications in
regular expressions, e.g. \p{L} ? It doesn't work in the following
code, any ideas?
-
#! /usr/local/bin/python
""" usage: ./uni_read.py file
"""
import codecs
import re
text = codecs.open(sys.argv[1], mode='r', encoding='u
Edgar Antonio Rodriguez Velazco wrote:
> Hi,
> Could you please explain this code?.
>
> f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
You've had 2 replies that dissect the "expression". I fear they might
not make lambda itself clear, so I will add my explanation.
lambda is a Python operator that
I need to execute a command and capture the stdout output. I'm
overwhelmed by the plethora of means that Python offers to do something
like this, and don't know which, if any, is most applicable:
1) the os.system module
2a-d) os.popen, and popen2 popen3 and popen4
3) the popen2 module
4) the subp
>> Could you please explain this code?.
>>
>> f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
>
> This is why lambdas are evil.
It's not the lambda thats evil its the need in Python to limit
them to a single expression.
If we write
def f(n):
return n-1 + abs(n-1) and f(n-1)*n or 1
its just
>> Could you please explain this code?.
>>
>> f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
>
>
>This is why lambdas are evil.
I meant to add to my last post that even using lambdas this
is a weird attempt at a factorial fiunction.
Here's the equivalent from my web tutor on functional
program
On 3/10/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
>> Could you please explain this code?. f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1>>>This is why lambdas are evil.I meant to add to my last post that even using lambdas this
is a weird attempt at a factorial fiunction.Here's the equivalent f
On 3/11/06, Pawel Kraszewski <[EMAIL PROTECTED]> wrote:
> Dnia piątek, 10 marca 2006 19:31, Edgar Antonio Rodriguez Velazco napisał:
>
> > f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1
>
> Oh God! This smells lispish! Haven't seen a jevel like this before, but I LOVE
> it!
Haha, hey, I've been le
On 3/10/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
>> Could you please explain this code?. f = lambda n: n-1 + abs(n-1) and f(n-1)*n or 1>> This is why lambdas are evil.It's not the lambda thats evil its the need in Python to limit
them to a single _expression_.If we writedef f(n): return n-1
Hi Terry,
> abc = executeit(commandline)or
> executeit(commandline, abc)
>
Looks like you are looking for the commands module, it provides:
getstatusoutput( cmd)
getoutput( cmd)
getstatus( file)
Which do exactly what tou want. Take a look at the docs at:
http://python.active-ve
ok say u want python to ask the user to type a username then password for a game account thats easy but how do u get the information they typed back to you?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Fri, 10 Mar 2006, [ISO-8859-1] Hugo Gonz?lez Monteverde wrote:
> Looks like you are looking for the commands module, it provides:
>
> getstatusoutput( cmd)
>
> getoutput( cmd)
>
> getstatus( file)
>
>
> Which do exactly what tou want. Take a look at the docs at:
>
> http://python.active-v
I have several lists... and i would like to some times chose from one
list and for a while choose from a different list, etc... so i cooked
this up and it almost works so that i can get colors 50% of the time,
doggies 25%, beer 10%, and guitars 100% (if i was real smart i would
make my index th
I noticed a couple days ago that the active state archive seems to have
ceased.
Is it going away?
cheers,
kevin
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
34 matches
Mail list logo