Hello
I'm having some trouble with my if, else statements. For some reason, the
months that have 31 days work fine, but the months that have 28/30 do not
work. Am I doing something wrong? it is supposed to take a date as an
input like 9/31/1991 and then say that the date is not valid because
septe
Hello people,
this is my first post as a test..
--
Anthoni Shogan
Fame is a vapor; popularity an accident; the only earthly certainty is oblivion.
-- Mark Twain
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/lis
> i want to pass an argument (a number) to a python
> script when running it:
>> python script.py
>
> i want to be able to use within script.py
> as a parameter.
>
> how do i set this up?
This is covered in the 'talking to the user' topic in my tutorial.
The short answer is use sys.argv
Alan
Bill this is a guess but try setting the terminal type to vt220
or vt330 or similar rather than xterm. Does that make any difference?
curses uses the termcap database to determine how int interacts with
the keyboard so changing the terminal type to somethingwell defined
might make a difference?
B
Dick Moores wrote:
> BTW in redemo.py, what do the checkboxes VERBOSE, LOCALE, and DOTALL
> mean? (I understand IGNORECASE and MULTILINE.)
http://docs.python.org/lib/node115.html
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
Kent Johnson wrote at 14:36 10/13/2005:
>Dick Moores wrote:
> > I've begun to try out redemo.py to test and learn regular
> expressions. It
> > doesn't seem to accept Python's raw strings as raw strings, e.g.,
> > r'python\.org' for matching python.org and nothing else. Am I
> correct,
> > or
combining the best of both worlds of nick using a faster list comp and brett using os.path.splitext():>>> files = ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG']>>> newFiles = [os.path.splitext
(f)[0] for f in files]>>> print newFiles['DSC1', 'DSC2', 'DSC3']cheers,-- wesley- - - - - -
Markus Rosenstihl wrote:
> Thank you for the fast reply
>
> Am 13.10.2005 um 19:43 schrieb Kent Johnson:
>
>
>
>> if len(filter(re_name.search, line)) > 0:
>>could be written
>> if re_name.search(line):
>
>
> this is not working because I am parsing a line in a list (i think):
Ah, sorry,
On Thu, 13 Oct 2005 [EMAIL PROTECTED] wrote:
> amount is supposed to equal fine because there are a couple of different
> fines. there is a fine for going over 90mph that includes a penalty and
> then there is a fine for just going over the speed limit as long as it
> is under 90.
Hi Andradel,
Greetings:
I have two comments to make.
First, I recommend renaming your variables to be more clear. For example:
#
speedlimit = input("Please enter the legal speed limit: ")
clockedspeed = input("Please enter the clocked speed limit: ")
excessspeed = clockedspeed - sp
I think you should check the if conditions with "clocked" not speedlimit which is the differential.
::akbarOn 10/13/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
amount is supposed to equal fine because there are a couple of differentfines. there is a fine for going over 90mph that includes a p
More than anything, I think clearer variable names will help here.
Something like:
def main():
... speed_limit = 60
... clocked = int(raw_input("Clocked speed:"))
... miles_over = clocked - speed_limit
... fine = 50 + 5 * miles_over
... if miles_over >= 30:
... pri
At 04:09 PM 10/13/2005, Marc Buehler wrote:
>hi.
>
>i want to pass an argument (a number) to a python
>script when running it:
> > python script.py
>
>i want to be able to use within script.py
>as a parameter.
>
>how do i set this up?
In the sys module there is a property argv. The docs say: "Th
On 14/10/05, Marc Buehler <[EMAIL PROTECTED]> wrote:
> hi.
>
> i want to pass an argument (a number) to a python
> script when running it:
> > python script.py
Have a look at sys.argv!
testargs.py
import sys
print sys.argv
C:\temp>python testargv.py 1 2 foo
['testargv.py', '1', '
z = raw_input("Please Enter? :\n")
On Thursday 13 October 2005 05:09 pm, Marc Buehler wrote:
> hi.
>
> i want to pass an argument (a number) to a python
>
> script when running it:
> > python script.py
>
> i want to be able to use within script.py
> as a parameter.
>
> how do i set this up?
>
> m
amount is supposed to equal fine because there are a couple of different
fines. there is a fine for going over 90mph that includes a penalty and then
there is a fine for just going over the speed limit as long as it is under
90.
> Is amount suppose to equal total instead of fine?
>
>
>
> On Thurs
hi.
i want to pass an argument (a number) to a python
script when running it:
> python script.py
i want to be able to use within script.py
as a parameter.
how do i set this up?
marc
---
The apocalyptic visio
Is amount suppose to equal total instead of fine?
On Thursday 13 October 2005 04:58 pm, [EMAIL PROTECTED] wrote:
> def main():
> actual = input("Please enter the legal speed limit: ")
> clocked = input("Please enter the clocked speed limit: ")
> speedlimit = clocked - actual
>
>
Hello
I am having trouble getting my program to calculate the correct total if
the speed limit is over 90mph. For example when i enter 100 for the
clocked speed and 50 for the actual speed it returns 300 when I should
receive 500. It also seems to be skipping over the else statement of if
the pers
> i create a list of all JPG files with:
> >>> list = glob.glob('*.JPG')
> the content of 'list' is now:
> >>> print list
> ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG']
>
> but what i want is this type of list:
> ['DSC1', 'DSC2', 'DSC3']
I would make use of os.path.splitext, which
Hi marc,
>
> i create a list of all JPG files with:
> >>> list = glob.glob('*.JPG')
> the content of 'list' is now:
> >>> print list
> ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG']
>
> but what i want is this type of list:
> ['DSC1', 'DSC2', 'DSC3']
> i.e. the names w/o the file e
hi.
i create a list of all JPG files with:
>>> list = glob.glob('*.JPG')
the content of 'list' is now:
>>> print list
['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG']
but what i want is this type of list:
['DSC1', 'DSC2', 'DSC3']
i.e. the names w/o the file extension.
what's the easi
Dick Moores wrote:
> I've begun to try out redemo.py to test and learn regular expressions. It
> doesn't seem to accept Python's raw strings as raw strings, e.g.,
> r'python\.org' for matching python.org and nothing else. Am I correct,
> or is there something I don't understand here?
In rede
Alan Gauld wrote at 14:09 10/13/2005:
>Hi Dick,
>
> > I've begun to try out redemo.py to test and learn regular
> expressions. It
> > doesn't seem to accept Python's raw strings as raw strings, e.g.,
> > r'python\.org' for matching python.org and nothing else. Am I
> correct,
> > or is there s
Hi Dick,
> I've begun to try out redemo.py to test and learn regular expressions. It
> doesn't seem to accept Python's raw strings as raw strings, e.g.,
> r'python\.org' for matching python.org and nothing else. Am I correct,
> or is there something I don't understand here?
I might be getti
I'm having an ``interesting'' problem running interactive python ncurses
applications in xterms under Mac OS X where the numeric keypad is forced
into application mode and the numlock key has no effect. We're using
curses with accounting and data entry applications for efficient keyboard
entry, wh
I've begun to try out redemo.py to test and learn regular expressions. It
doesn't seem to accept Python's raw strings as raw strings, e.g.,
r'python\.org' for matching python.org and nothing else. Am I correct,
or is there something I don't understand here?
BTW redemo.py can be found in Pyth
Hi!...
i am new to Python and i want to develop a website with forms; data submitted through forms will be stored in PostgreSQL.
I am working on derivant of FC3, OpenLX.
I have Apache 2.0.54 version installed, which is pre-configured with mod_python.
how do i load and view my .py/.html web page (f
Thank you for the fast reply
Am 13.10.2005 um 19:43 schrieb Kent Johnson:
> if len(filter(re_name.search, line)) > 0:
> could be written
> if re_name.search(line):
this is not working because I am parsing a line in a list (i think):
Traceback (most recent call last):
File "telekom2.py
On 10/13/05, Nick Lunt <[EMAIL PROTECTED]> wrote:
> I'm really confused on the issue how to create windows, forms, etc. in> Python & can't find any manual for that.> Could you possibly advise me smth useful?this has come up quite a bit recently on the list.
I would recommend that you go herehttp://
hello ,
when i run this code for unigramtagger :
from nltk.tagger import *from nltk.corpus import brown # Tokenize ten texts from the Brown Corpustrain_tokens = []for item in brown.items()[:10]: train_tokens.append(brown.read(item)) # Initialise and train a unigram taggermytagger = Unigr
Hi Olexiy,
> I'm really confused on the issue how to create windows, forms, etc. in
> Python & can't find any manual for that.
> Could you possibly advise me smth useful?
> --
> Best regards,
>
> Olexiy Kharchyshyn
this has come up quite a bit recently on the list.
I would recommend that you go
Hi Lawrence,
In a UNIX environment the method used to determine if a process is
running is to issue a "kill -0 pid". If the process is running the
return value will be zero (0) and -1 with errno set to ESRCH - No
process or process group can be found corresponding to that specified by
pid.
THANX
I'm really confused on the issue how to create windows, forms, etc. in
Python & can't find any manual for that.
Could you possibly advise me smth useful?
--
Best regards,
Olexiy Kharchyshyn
[EMAIL PROTECTED]
___
Tutor maillis
Markus Rosenstihl wrote:
> Hi,
> I wrote a program (see below) to analyse my phone bill, which is shared
> by three others and I don't know if there is a way to make lines like
> this nicer:
> if len(filter(re_name.search, line)) > 0 and len(filter(re_misc.search,
> line)) == 0
if len(filter
So I have a list of pids, and I want to check whether the pids still
refer to live processes or not. Currently I'm doing that thus:
pids = ['4550\n', ...]
procs = os.popen("ps ax|grep %s|awk '{ print $1 }'" % keyword).readlines()
and comparing the two lists. I'm wondering, though, if there's a wa
Hi,
I wrote a program (see below) to analyse my phone bill, which is shared
by three others and I don't know if there is a way to make lines like
this nicer:
if len(filter(re_name.search, line)) > 0 and len(filter(re_misc.search,
line)) == 0
Is there for example a way to search the whole list
Joseph Quigley wrote:
> Hey, if you are a Garfield fan or you just want to see the source code,
> you can download the whole kaboodle (it's cross platform) from:
> http://www.jqsoftware.com/software/Gacor/gacor-096.py
I hope you like some comments...
IMO the use of the Data class as a global op
On Thursday 13 October 2005 01:08, Kent Johnson wrote:
> Michael Sparks wrote:
> > On Wednesday 12 October 2005 23:19, Kent Johnson wrote:
> >>I don't think you can compile python code
> >
> > Pypy can compile a restricted subset of python...
>
> There is also Shed Skin - "an experimental Python-to
Mike Hansen wrote:
>>From:
>>Kent Johnson <[EMAIL PROTECTED]>
>>I think the conventional advice is something like, if you don't
>>understand why using slots is a bad idea, you have no business using
>>them :-)
>>
> Can you tell us the pros and cons of using slots?
I think I am in the group of p
Message: 5
Date: Thu, 13 Oct 2005 05:51:04 -0400
From: Kent Johnson <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Problem with Winpdb.
Cc: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Steve Robb wrote:
> Can anyone point me to what
Hi,
Thank you all for your help. I must say that the python mailing list is
the most helpfull of any place I've ever asked for help on. A close
second comes linuxquestions.org.
Somehow sort() got passed me in the Python Documentation and sort() has
fixed all my problems.
EDIT> Sort still didn'
> Subject:
> Re: [Tutor] __slots__
> From:
> Kent Johnson <[EMAIL PROTECTED]>
> Date:
> Wed, 12 Oct 2005 18:22:46 -0400
>
> CC:
> Python Tutor Mailing List
>
>
> Liam Clarke wrote:
>
>> Well, all I can say is, don't use them unless you need them, they're a
>> lot of hassle.
>
>
> I think the
Steve Robb wrote:
> Can anyone point me to what the problem may be with running Winpdb?
>
> I am running Win98, unfortunately
>
> However, when I try,
> ..\python _winpdb.py, from the same directory, I get the following
> traceback.
>
> Traceback (most recent call last):
> File "C:\Python24\L
> > As a matter of interest why do you need so many in RAM at once?
>
> I'm creating an object for each header (for want of a better word.) A
> song is described by an object with several children objects, each one
> has certain attributes.
OK, But you only need the song object group to manipulat
> below is my code and everytime I input a value of 16 or more it keeps
> returning sophomore. could anyone help me figure out what to change so
> that it won't return sophmore for things greater than or equal to 16?
This is one of the gotchas of if/elif chains and I discuss it in
my branching to
>>I use Delphi for most of my real-world heavy duty GUI work.
>>
> Have you tried Boa Constructor? It is quite similar to Delphi. It builds
> wxPython.
I tried it a couple of years ago but couldn't get it to work!
Even if I had it didn't offer many of the features of VB/Delphi such
as live da
Hello Andrew,
Thanks for the info.
I wonder if everytime we have to solve loop inside loop which use big array will force us to think another algorithm like matrix model. Since this model is suitable with Numeric.py
I think looping style sometimes easier to describe our problem.
pujo
On 10/1
It's way past my bedtime, but any use of numpy/numarray that involves
two nested for loops to step over each element is the wrong solution
:) You need to figure out how to get rid of that inner for.
That is what is slowing you down.
Compare these two ways to multiply a 1000 element array by 10
luke p wrote:
nathan,
there are a few GUI options available to you.
the one that is bundled with the python installation is
TKInter. that's an "i" not an "L".
you can also use the python interface for WxWindows, I
forget what it's called.
anyway,
TKInter looks fairly nice, some sa
hello chun,
I use Numeric.
using 'while' instead of for, has the same effect. still slow
pujo
On 10/13/05, w chun <[EMAIL PROTECTED]> wrote:
On 10/12/05, Pujo Aji <[EMAIL PROTECTED]> wrote:> I have code like this:
>> def f(x,y):> return math.sin(x*y) + 8 * x>> def main():> n = 2000>
On Wed, 12 Oct 2005 11:41:16 -0500, Steve Robb <[EMAIL PROTECTED]> wrote:
>Can anyone point me to what the problem may be with running Winpdb?
>[snip]
Hello Steve,
I think, best would be to post this into:
http://sourceforge.net/projects/winpdb/
bug tracker.
--
Franz Steinhaeusler
___
>
> """By default, C numbers are represented in the machine's native format
> and byte order, and properly aligned by skipping pad bytes if necessary
> (according to the rules used by the C compiler)."""
>
>
> Does this make sense? Please feel free to ask more questions on this;
> it's a bit of a
On 10/13/05, Johan Geldenhuys <[EMAIL PROTECTED]> wrote:
> Hi all,
> Can Python be used to do PLC (programmable logic controller)
> programming? I'm not sure because Python needs some platform to run on?
>
> Thanks,
>
> Johan
> ___
> Tutor maillist - Tu
On 10/13/05, Alan Gauld <[EMAIL PROTECTED]> wrote:
> > an object with 70ish attributes makes. FWIW, I'm doing the exact
> > opposite of XP, and building to handle 300,000 to 600,000 objects...
>
> As a matter of interest why do you need so many in RAM at once?
> Its very unusual to require that man
On 10/12/05, Pujo Aji <[EMAIL PROTECTED]> wrote:
> I have code like this:
>
> def f(x,y):
> return math.sin(x*y) + 8 * x
>
> def main():
> n = 2000
> a = zeros((n,n), Float)
> xcoor = arange(0,1,1/float(n))
> ycoor = arange(0,1,1/float(n))
>
> for i in range(n):
> fo
56 matches
Mail list logo