Wayne Watson sierra_mtnv...@sbcglobal.net wrote
I installed Python 2.5 a few months ago, and decided I'd like to
try
windowpy from ActiveState. Is having both of these installed going
to
cause me trouble?
Multiple versions of Python should not be a problem provided you put
them in
Marco Petersen marco.m.peter...@gmail.com wrote
I have Python 3.0. I tried to use the 2to3 program included with the
interpreter to convert some scripts for Python 2.5 to Python 3.0
ones.
When I try to start it form the Python command line, it says it is a
syntax error.
Its always best to
Title: Signature.html
Thanks. Is it possible to just disable the vanilla version? I may want
to switch between the two. Most users of the program I'm about to
modify use the vanilla version. At some point, I may want to go back to
it to verify that in their world all is OK.
Alan Gauld wrote:
On Mon, Jan 12, 2009 at 3:56 AM, Alan Gauld alan.ga...@btinternet.com wrote:
Marco Petersen marco.m.peter...@gmail.com wrote
This was the line of code:
$ 2to3 testscript.py
But I suspect...
this will run your default python interpreter which is likely to still
be your 2.5 version. THe
Marco Petersen marco.m.peter...@gmail.com wrote
This was the line of code:
$ 2to3 testscript.py
But I suspect...
this will run your default python interpreter which is likely to still
be your 2.5 version. THe convertion scrpt is almost certainly 3.0.
So I think you will need to explicitly
Hello everyone,
What is the pythonic was of selecting the first element of a
list matching some condition?
I often end up using
[x for x in lst if cond(x)][0]
This looks bad and raises IndexError if nothing is found which
is ugly too.
Thanks.
--
~noufal
Noufal Ibrahim wrote:
Hello everyone,
What is the pythonic way of selecting the first element of a
list matching some condition?
I often end up using
[x for x in lst if cond(x)][0]
This looks bad and raises IndexError if nothing is found which
is ugly too.
1)
1) itertools.dropwhile(cond, lst) will return a list with the desired element
first.
i think in order to use this, the OP needs to invert his Boolean logic
because it *drops* elements while the conditional is True. as soon as
it hits False the 1st time, all remaining elements (including the
On Mon, Jan 12, 2009 at 12:21 PM, bob gailer bgai...@gmail.com wrote:
Noufal Ibrahim wrote:
Hello everyone,
What is the pythonic way of selecting the first element of a list
matching some condition?
I often end up using
[x for x in lst if cond(x)][0]
This looks
I've managed to do something incredibly stupid on my XP box.
I've created a folder that is a link to itself - at least I think
that's what has
happened, it was a CASE tool that I was using that actually did the
damage.
The symptoms are that I can infinitely navigate down to the next
level.
I
did you try rd /s /q from the root directory command prompt?
-L
On Jan 12, 2009, at 11:07 AM, Alan Gauld wrote:
I've managed to do something incredibly stupid on my XP box.
I've created a folder that is a link to itself - at least I think
that's what has
happened, it was a CASE tool that I
From: Alan Gauld alan.ga...@freenet.co.uk
Date: Mon, 12 Jan 2009 19:07:23 -
Subject: [Tutor] Deleting recursive folder definition
I've managed to do something incredibly stupid on my XP box.
I've created a folder that is a link to itself - at least I think that's what
has
happened, it
On Mon, Jan 12, 2009 at 2:07 PM, Alan Gauld alan.ga...@freenet.co.uk wrote:
I've managed to do something incredibly stupid on my XP box.
I've created a folder that is a link to itself - at least I think that's
what has
happened, it was a CASE tool that I was using that actually did the damage.
Alan Gauld alan.ga...@freenet.co.uk wrote in message
news:50c11a8b9db748fa9e6e892067cce...@xp...
I've managed to do something incredibly stupid on my XP box.
I've created a folder that is a link to itself - at least I think that's
what has
happened, it was a CASE tool that I was using that
Hello all,
I have used *args and **kwargs to have a function accept optional parameters,
but is there a lazy way to optionally pass parameters? For example, say my
script can accept a number of parameters for a database connection, such as
user, password, and database name. The function that
A small correction to my code, although the point was hopefully still clear:
if options.user:
do_mysql_query(options.user)
else:
do_mysql_query()
From: wormwood_3 wormwoo...@yahoo.com
To: Python Tutorlist tutor@python.org
Sent: Monday, January 12,
On Mon, Jan 12, 2009 at 4:39 PM, wormwood_3 wormwoo...@yahoo.com wrote:
Hello all,
I have used *args and **kwargs to have a function accept optional
parameters, but is there a lazy way to optionally pass parameters? For
example, say my script can accept a number of parameters for a database
# The natural numbers(natnum), under 1000, divisible by 3 or by 5 are to
be added together.
natnum = 0
num3 = 0
num5 = 0
cume = 0
# The 'and' is the 15 filter; the 'or' is the 3 or 5 filter.
while natnum = 999:
num3 = natnum/3
num5 = natnum/5
if natnum - (num3 * 3) == 0 and natnum -
You know, that's a great idea :-) Just using options I could keep my initial
checks the same (e.g. making sure needed options were included by looking at
options.foo) and pass it along without adding much to the query function.
Thanks!
___
Samuel Huckins
Homepage -
On Mon, Jan 12, 2009 at 5:23 PM, WM. wfergus...@socal.rr.com wrote:
# The natural numbers(natnum), under 1000, divisible by 3 or by 5 are to be
added together.
natnum = 0
num3 = 0
num5 = 0
cume = 0
# The 'and' is the 15 filter; the 'or' is the 3 or 5 filter.
while natnum = 999:
num3 =
Hello,
I have been struggling a while trying to figure out how to modify a csv file
using the csv.DictWriter class. Let's suppose I have the following code:
import csv
outfile=open('template.csv','w') # This is a pre-existing file that
contains 3 variables (3 columns). The variables
Judith Flores jur...@yahoo.com wrote
I have been struggling a while trying to figure out how to modify
a csv
file using the csv.DictWriter class. Let's suppose I have the
following code:
I have never used DictWriter but...
outfile=open('template.csv','w') # This is a pre-existing
2009/1/13 Judith Flores jur...@yahoo.com:
Hello,
Hi Judith,
1. When I run the code above for the first time, the contents of the
pre-existing file disappear, if I
run the script a second time, now I can see the value of x.
This is a consequence of this line:
WM. wrote:
# The natural numbers(natnum), under 1000, divisible by 3 or by 5 are
to be added together.
natnum = 0
num3 = 0
num5 = 0
cume = 0
# The 'and' is the 15 filter; the 'or' is the 3 or 5 filter.
while natnum = 999:
num3 = natnum/3
num5 = natnum/5
if natnum - (num3 * 3) == 0
I have a problem with understanding how lists, strings, tuples, number
types and input arguments all interact with each other.
I have this program, in which I can use the *a structure to input
unlimited arguments.
As an example, if I use three arguments, it looks like this:
def main():
#Play
25 matches
Mail list logo