> 1) the os.system module
> 2a-d) os.popen, and popen2 popen3 and popen4
> 3) the popen2 module
> 4) the subprocess module
Take a look at the OS topic in my tutorial. The process control section
covers all of these calls and explains their differences. It also points out
that the latter is intende
> we don't all agree on everything, but that we can disagree politely and
> still be helpful.
One of the truly great things about Python is the user community, by
far the most civilised that I've encountered in my 20 years or so of
internet use.
Long may it continue,
Alan G.
__
kevin parks wrote:
> 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.
You don't say what isn't working but I have a guess. The actual windex()
function looks OK to me.
> def test():
>
> lst_a = [ 'red', 'green
Michael Broe wrote:
> 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?
From http://www.unicode.org/unicode/reports/tr18/ I see that \p{L} is
intended to select Unicode letters, and it is p
Hi all,
I'm trying to think of a way to sort a list of dictionaries. In pseudo-code:
l = [ { "host":"foo", "db":"bob"},
{ "host":"foo", "db":"dave"},
{ "host":"fee", "db":"henry"}
]
l.sort( key = lambda item: item["host"], second_key = lambda item: item["db"])
Which, if all w
On 11 Mrz 2006, [EMAIL PROTECTED] wrote:
> I'm trying to think of a way to sort a list of dictionaries. In pseudo-code:
>
> l = [ { "host":"foo", "db":"bob"},
>{ "host":"foo", "db":"dave"},
>{ "host":"fee", "db":"henry"}
> ]
>
> l.sort( key = lambda item: item["host"], second_
Liam Clarke wrote:
> Hi all,
>
> I'm trying to think of a way to sort a list of dictionaries. In pseudo-code:
>
> l = [ { "host":"foo", "db":"bob"},
>{ "host":"foo", "db":"dave"},
>{ "host":"fee", "db":"henry"}
> ]
>
> l.sort( key = lambda item: item["host"], second_key = la
def vmod(a , b ):
.r1 = b
.r2 = a
. m1 = 0
.m2 = 1
.q = Int(r1 / r2)
.r3 = r1 - q * r2
.m3 = m1 - q * m2
.while r3 != 0:
...r1 = r2
...m1 = m2
...r2 = r3
...m2 = m3
...q = Int(r1 / r2)
...r3 = r1 - r2 * q
...m3 = m1 - m2 * q
.If r2 == 1:
...If m2 < 0:
.return( m2 + b)
...Else:
.ret
On Sat, 2006-03-11 at 10:42 -0500, Kermit Rose wrote:
> I get the message
>
> syntax error
>
>
> and it highlightsr2
>
> in the line
>
> .If r2 == 1:
if should be lower case
(all of the python syntax words are lower case)
You will also need to change Else and Elif
Int should probably b
On Sat, 11 Mar 2006, Alan Gauld wrote:
> Take a look at the OS topic in my tutorial. The process control section
> covers all of these calls and explains their differences. It also points out
> that the latter is intended to replace all the others and shows examples.
Excellent; I'll check it out.
Hi Michael and Kent,
thanks to your tips I was able to solve my problems! It was quite easy at
last.
For those interested and struggling with utf-8, ascii and unicode:
After knowing the right way of
- string.decode() upon input (if in question)
- string.encode() upon output (more often th
On Sat, 11 Mar 2006, kevin parks wrote:
> I noticed a couple days ago that the active state archive seems to have
> ceased. Is it going away?
Hi Kevin,
Can you check this again? It appears to look ok to me:
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/python-Tutor
_
> I get the message
>
> syntax error
>
>
> and it highlightsr2
>
> in the line
>
> .If r2 == 1:
Hi Kermit,
Next time, rather than describe the error message here in paraphrase,
please copy-and-paste it in. Your paraphrase of the situation here hides
useful information. We would rather that
Hi,
It would help us a lot if you send us a cut n paste of the actual code,
not retyped versions. Particularly for syntax erros since a single wrong
character might be all that's wrong and when you retype it its OK.
I'm assuming you are retyping from the fact that you have uppercase
keywords e
>> But in this case I'd use Pytthon to search for the string and get the
>> last 10 entries rather than grep/head...
>
> That was my initial thought, but the files are 1-3 gigabytes. The string
> command takes 10-15 minutes to get through a file. I've been using the
> pipe sequence manually, so
[CC'd to the list...]
>> Also for the error merssage can you cut n paste the full error since
>> they contain a lot of useful info, do not just give us a description of
>> the error.
>no error message was provided.
> It only highlighted the variable in the If statement.
But that's exactly what w
On Mar 11, 2006, at 3:24 PM, [EMAIL PROTECTED] wrote:
>
> Message: 1
> Date: Sat, 11 Mar 2006 08:34:49 -0500
> From: Kent Johnson <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] weighted choices from among many lists
> Cc: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain;
Thanks Kent, for breaking the bad news. I'm not angry, just terribly,
terribly disappointed. :)
"From http://www.unicode.org/unicode/reports/tr18/ I see that \p{L} is
intended to select Unicode letters, and it is part of a large number of
selectors based on Unicode character properties."
Yeah,
On Sat, 11 Mar 2006, Alan Gauld wrote:
> But surely the string command will take just as long to run regardless
> of whether you use pipes or read the output into Python?
Surely it will! Except that it doesn't.
> Are ytou saying that running strings on its own takes 10 minutes but
> running it
Ahaha, thanks guys, I knew I was overlooking something.
Regards,
Liam Clarke
On 3/12/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Liam Clarke wrote:
> > Hi all,
> >
> > I'm trying to think of a way to sort a list of dictionaries. In pseudo-code:
> >
> > l = [ { "host":"foo", "db":"bob"},
> >
kevin parks wrote:
>>From: Kent Johnson <[EMAIL PROTECTED]>
>>If you want to be able to print the name of the list then you could
>>include both the name and the actual list in x:
>>
>> x = [(('lst_a', lst_a), .50), etc...]
>
>
>
> That produces:
> ('lst_c', ['Ale', 'Lager', 'Pilsner', 'Boc
On Sat, 11 Mar 2006, Terry Carroll wrote:
> I gotta admit, this took me by surprise, too, but my guess is that once
> the head command is done, it closes the pipe it's reading from, which is
> being filled by grep; grep takes the hint and terminates, closing the pipe
> it's reading from, which
Willi Richert wrote:
> Hi,
>
> for some time I try to find the best test code organization. I've come
> up with the following solution, which I guess is not optimal. Please
> comment.
OK I'll take a stab at it.
>
> In the code directory there is a special tests directory, which contains
> all
> Yes, you need to unpack the result of calling windex(). You so ably
> demonstrated unpacking the list in your for loop I thought you would
> figure it out :-)
>
> Try
>lst_name, lst = windex(x)
>
> then random.choice() and print.
>
Thanks Kent i got it, just another brain-fart on my side...
| From: sjw28
|
| 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
On Sat, 11 Mar 2006, Terry Carroll wrote:
> Just for the heack of it, I wrote a tiny Python echo program, and
> interposed it in the pipe between the strings and grep command:
>
> while 1:
> line = raw_input()
> print line
>
> The command line now looks like this:
>
> strings 3
ok, while we're on the subject, i thought i should ask a question for
once(!). it's been awhile since i played with pipes, and i ran into
this problem on the same day as this post!
if i'm in the shell and playing with a 2-way game with the 'tr' command like so:
$ tr '[a-z]' '[A-Z]'
us
US
ca
CA
d
27 matches
Mail list logo