On Thu, 10 Feb 2005, Ismael Garrido wrote:
> Danny Yoo wrote:
>
> >###
> >
> >def f(a,L=[]):
> >if L==[5]:
> >print 'L==[5] caught'
> >print L
> >print 'resetting L...'
> >L=[]
> >L.append(a)
> >return L
> >###
> >
> Now I'm dizzy... I can't understand
I am not so clued up on the 'base 2' and 'base 8' stuff.
Care to explain that a little?
Johan
On Tue, 2005-02-08 at 12:12, Pierre Barbier de Reuille wrote:
MMmmhh ... no !
The number you wrote is equivalent to '010' and any number beginning by
'0' and not followed by "x" will be considered
On Feb 10, 2005, at 03:07, Ismael Garrido wrote:
Danny Yoo wrote:
###
def f(a,L=[]):
if L==[5]:
print 'L==[5] caught'
print L
print 'resetting L...'
L=[]
L.append(a)
return L
###
Now I'm dizzy... I can't understand why there are two "L"!
L is a local variable of
Danny Yoo wrote:
###
def f(a,L=[]):
if L==[5]:
print 'L==[5] caught'
print L
print 'resetting L...'
L=[]
L.append(a)
return L
###
Now I'm dizzy... I can't understand why there are two "L"!
L is a local variable of the function, right? (I can't imagine it bein
I'd echo what Alan said. It sounds more like you're having trouble
finding out what the command line to SAS should look like, rather than
invoking it with Python.
(I'm going to quote some of your message out-of-order to better facilitate
my approach to this. I will, I trust, not misrepresent
Danny Yoo said unto the world upon 2005-02-09 19:06:
If we want to be fancy, we can also take advantage of Python's generator
support to avoid constructing an explicit list:
Hi Brian,
Oh good grief. *grin*
That last snippet won't work; I had forgotten about appending lines into
current_node_conte
> If we want to be fancy, we can also take advantage of Python's generator
> support to avoid constructing an explicit list:
>
> ###
> def partition_node_content(self, body_contents):
> """Returns an iterator whose contents are a bunch of
>node_content lists."""
> c
On Wed, 9 Feb 2005, Brian van den Broek wrote:
> Hi all,
>
> I have data files with a format that can be scheamatized as:
>
> File Header Contents
> . . .
> File Header End Tag
> Node Header Contents
> . . .
> Node Header End Tag
> Node Contents
> . . .
> Node End Tag
> [Repeat Node elements unt
On Wed, 09 Feb 2005 23:50:49 +0100, Abel Daniel <[EMAIL PROTECTED]> wrote:
>
> quoted lines are from Jeffrey Lim
> [... I have rearranged the order of the quotes ...]
>
thanks, Abel! Especially for the part on the 'C' concept of variables,
vs that of Python's (and the links, as well).
appreciat
On Wed, 9 Feb 2005 22:38:20 -, Alan Gauld <[EMAIL PROTECTED]> wrote:
> >
> > My questions:
> >
> > [snip]
>
> [snip]
>
> HTH,
yes it did! I've already gotten it - but your explanation was just
simply beautiful (it really is). Thanks for the note about "not in
think in terms of C" as well - I'
quoted lines are from Jeffrey Lim
[... I have rearranged the order of the quotes ...]
> How is 'L == None' even possible all the time, given that for
> def f(a, L=[]):
> L.append(a)
> return L
> , L isn't even [] except for the first call to 'f'?
This is the important point. You see, its
On Wed, 9 Feb 2005 14:05:23 -0800 (PST), Danny Yoo
<[EMAIL PROTECTED]> wrote:
>
> [snip]
>
> Does this make sense so far?
YES!!! Most perfectly!!! Thanks for your detailed step-by-step
analysis man - it was very helpful, and much appreciated...
>
> Looking back at the program, I think that you
>
> My questions:
> - is the '==' operation a 'list' comparison - rather than a pointer
> comparison? (my experiments seem to indicate that it is a 'list'
> comparison)
Forget pointers and all you ever knew of them from C.
Trying to think of Python in terms of Pointers is ultimately
an excercise i
> This leads me to at first conclude several things:
>
> 1. 'L' in this case (or by extension, all function arguments for
which
> a default is given in the function definition) is "static"
Pretty close, yes. Especially if the parameter is mutable.
> language definition). This is my conclusion, se
> os.execl('C:\Program Files\SAS Institute\SAS\V8\SAS.exe')
You might find that os.system() is all you need here,
but if execl works don't worry too much.
> However, the program in question is c:\work\run_ratios.sas, with 2
> parameters: incov, and outcov. This program was initially invoked
from
On Wed, 09 Feb 2005 14:51:42 -0700, Bob Gailer <[EMAIL PROTECTED]> wrote:
> At 02:22 PM 2/9/2005, Jeffrey Lim wrote:
> >and have the Common Courtesy to stop hijacking or rewriting other
> >people's thread titles unnecessarily pls. (Like when was this thread
> >ever about the change of email address
> I'm trying to get only the lines that start with
> "This" for a text file.
>
> Here's what I wrote:
>
> >>> import re
> >>> f = open('c:/lines.txt').readlines()
> >>> for line in f:
> match = re.search('^This',f)
> if line == match:
> print match
try
if line.startwith('This'):
its easi
Hi all,
I have data files with a format that can be scheamatized as:
File Header Contents
. . .
File Header End Tag
Node Header Contents
. . .
Node Header End Tag
Node Contents
. . .
Node End Tag
[Repeat Node elements until end of file]
I'm refactoring the heck out of a file conversion utility I wr
On Thu, 10 Feb 2005, Jeffrey Lim wrote:
> > >
> > >Example 1
> > > >>> def f(a,L=[]):
> > >... if L==[5]:
> > >... print 'L==[5] caught'
> > >... print L
> > >... print 'resetting L...'
> > >... L=[]
> > >... L.append(a)
> > >... return L
> > >...
Hi Jeffery,
> PhoneNumber and such, I cannot get it to put them in
> as a string?
I can't help in general but I did notice...
> PhoneNumber = input("what is the phone number for the
> person you are adding? ")
You shouldn't store phone numbers as numbers.
People often include spaces or hyphens or parenthes
On Wed, 9 Feb 2005 13:12:22 -0800, Mike Bell <[EMAIL PROTECTED]> wrote:
> The function's local variable L is not static, but "default argument
> value" is, which is what the documentation means when it says that it
> will evaluate these only once. When the default value is a list (in
> your code,
At 02:22 PM 2/9/2005, Jeffrey Lim wrote:
and have the Common Courtesy to stop hijacking or rewriting other
people's thread titles unnecessarily pls. (Like when was this thread
ever about the change of email address change on your part???)
I have no idea how this happened. My computer started acting
and have the Common Courtesy to stop hijacking or rewriting other
people's thread titles unnecessarily pls. (Like when was this thread
ever about the change of email address change on your part???)
-jf
___
Tutor maillist - Tutor@python.org
http://mail.
On Wed, 09 Feb 2005 14:12:30 -0700, Bob Gailer <[EMAIL PROTECTED]> wrote:
> At 01:14 PM 2/9/2005, Jeffrey Lim wrote:
> >
> >Example 1
> > >>> def f(a,L=[]):
> >... if L==[5]:
> >... print 'L==[5] caught'
> >... print L
> >... print 'resetting L...'
> >... L=[]
> >...
The function's local variable L is not static, but "default argument
value" is, which is what the documentation means when it says that it
will evaluate these only once. When the default value is a list (in
your code, not "the empty list" but a list which happens to be empty
when the default argum
At 01:14 PM 2/9/2005, Jeffrey Lim wrote:
hey folks, i'm a relative newbie to python itself, and I am currently
learning by making my way through the tutorial found within the docs
of 2.4 (http://www.python.org/doc/2.4/tut/tut.html).
I am currently having a problem dealing with the concept of the
"d
hey folks, i'm a relative newbie to python itself, and I am currently
learning by making my way through the tutorial found within the docs
of 2.4 (http://www.python.org/doc/2.4/tut/tut.html).
I am currently having a problem dealing with the concept of the
"default argument value" in python functio
At 09:35 PM 2/8/2005, james middendorff wrote:
I want to use mysqldb to add people into a database,
but when I ask for the certain fields like Name,
PhoneNumber and such, I cannot get it to put them in
as a string?
You can increase your chances of getting help by telling us what happens
when you e
Here is the code I am using to invoke SAS:
import os
import sys
shell = os.environ.get('COMSPEC')
if shell is None: shell = os.environ.get('SHELL')
if shell is None: shell = 'an unknown command processor'
print 'Running under', shell
os.exe
Liam Clarke wrote:
print [w for w in j.split() if w[0] == '*' and w[-1] == '*']
Wouldn't that only work if it was bug *car* jeff?
I can imagine bug*car*jeff would throw it.
Cheers,
Liam Clarke
x = 'bug*car*jeff*foo*bar'
[x.split('*')[a] for a in range(1,len(x.split('*')), 2)]
When you mix * and
print [w for w in j.split() if w[0] == '*' and w[-1] == '*']
Wouldn't that only work if it was bug *car* jeff?
I can imagine bug*car*jeff would throw it.
Cheers,
Liam Clarke
--
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic
Damn!
C&P-bug here to! Is this a virus? ;-)
print [w for w in j.split() if words[0] == '*' and words[-1] == '*']
Should be:
print [w for w in j.split() if w[0] == '*' and w[-1] == '*']
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman
Liam Clarke wrote:
x= ["Dude", 'How is it going man', ' ']
print x
['Dude', 'How is it going man', ' ']
j=[]
for item in x:
... if re.search('\S+',item):
... j.append(item)
print j
['Dude', 'How is it going man']
What about:
x= ["Dude", 'How is it going man', ' ']
>>> x= ["Dude", 'How is it going man', ' ']
>>> print x
['Dude', 'How is it going man', ' ']
>>> j=[]
>>> for item in x:
... if re.search('\S+',item):
... j.append(item)
>>> print j
['Dude', 'How is it going man']
Now, I first did that in a Perl script, but it easily come
Wolfram Kraus a écrit :
Liam Clarke wrote:
regexes are common across a lot of languages, even Java has them.
Though the pain that would be I daren't not imagine. So the syntax is
familiar, whereas string methods may not be.
But IMHO string methods are (more) explicit and readable, the name tells
Liam Clarke wrote:
regexes are common across a lot of languages, even Java has them.
Though the pain that would be I daren't not imagine. So the syntax is
familiar, whereas string methods may not be.
But IMHO string methods are (more) explicit and readable, the name tells
you what the method is
regexes are common across a lot of languages, even Java has them.
Though the pain that would be I daren't not imagine. So the syntax is
familiar, whereas string methods may not be.
On Wed, 09 Feb 2005 09:00:52 +0100, Wolfram Kraus
<[EMAIL PROTECTED]> wrote:
> Ron Nixon wrote:
> > Can anyone tell
Ron Nixon wrote:
Can anyone tell me what I've done wrong in this
script.
I'm trying to get only the lines that start with
"This" for a text file.
Here's what I wrote:
import re
f = open('c:/lines.txt').readlines()
for line in f:
match = re.search('^This',f)
if line == match:
38 matches
Mail list logo