Krystle Scott wrote:
> i need to write an algorithm for computing square roots.
> so far I have
This sounds like a class exercise. I think we can help you with
Python questions, but you'll need to do the part that is directly
related to your homework on your own.
> import math
>
> def main ():
Kent Johnson wrote:
> Hans Fangohr wrote:
>
>> In [2]: 2 in [1,2,3] == True
On a slightly different tangent from the other answers you've received
to this question, if you're using a conditional expression, don't
compare it explicitly with True or False, just state the condition:
if 2 in [1,2,
how to fix it. I
have searched the Python.org website but was unable to find any reference to
this. Any help would be greatly appreciated.
Thanks very much,
Steve
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http
will operate from
Pythonwin from now on. A couple of folks also mentioned a book, Beginning
Python: From Novice to Professional. I think I might try
that.
Again, thanks everyone for all the help. I was very
impressed with the response to my cry for help.
- Steve
_path
app_data = os.environ['APPDATA']
File "C:\PYTHON24\lib\os.py", line 422, in __getitem__
return self.data[key.upper()]
KeyError: 'APPDATA'
Thanks in advance for any help,
Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
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 any
t I enter as a parameter.
I know I am going to feel really dumb when I hear the explanation but please
remember I’m new to this.
Thanks very much,
Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Kent and Todd,
Thanks for the help on my quick question regarding
readlines. That helped a lot.
- Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
tively.
How could I do this?
Thanks,
Steve Bergman
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 07 Nov 2005 11:50:05 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote:
> Johan Geldenhuys <[EMAIL PROTECTED]> writes:
>
> > What is the syntax if I want to work out what percentage 42 is out of 250?
>
> If you want it as a factor to multiply / divide by something:
>
> perc = 42/250
Don't you need t
bothers me.
Can anyone suggest why my laptop won’t produce a bell? Does the fact
that I’m running version 2.1 have something to do with it? Does my
laptop have something against me and just doesn’t want to ring its bell
for me? (just kidding with that last one)
Thanks in advance.
Steve
twalk/download.html
I have hacked it to give it access to other databases I have stored in
MySQL and have started a generic version of it to display the MySQL
database itself. Seems very cool.
Steve
> Message: 9
> Date: Mon, 14 Nov 2005 18:12:42 -
> From: "Alan Gauld" <[EMAIL PR
Windows Explorer or use the “Run”
command. You live and learn.
Thanks again.
Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
#x27;m just not seeing it. You can probably tell I'm just learning Python so any help would be appreciated.
Thanks very much in advance,
Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello,
I'm trying to work on some programs to help me understand ciphers and
ultimately cryptography. I've understood so far, that a simple form
of bit-level cryptography is to split the original message into chunks
the same length as a 'key' and then do an xor. I'm trying to keep
this really si
On 3/14/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
> The idea is to unpack four single characters as a single 4-byte integer.
That's really useful, thanks, as I was planning to iterate over each
letter and call ord()
> This kind of transformation is reversable:
Highly useful. Thanks very much in
On 3/14/06, Matthew Webber <[EMAIL PROTECTED]> wrote:
> As a side note, remember that that xor-ing a key with a message is trivial
> to break (it's just a variation on the Vigenere cipher first published in
> 1568). So don't use if for any real applications.
Yes - at the moment this is just a way
On 3/14/06, Steve Nelson <[EMAIL PROTECTED]> wrote:
> On 3/14/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
> > The idea is to unpack four single characters as a single 4-byte integer.
>
> That's really useful, thanks, as I was planning to iterate over e
Hello all,
Further to my previous puzzling, I've been working out the best way to
chop a string up into n-sized words:
I'm aware that I can use a slice of the string, with, eg, myWord[0:4].
I am also aware that I can do blob = myWord.pop(0) to take (and
remove) the first character. I can botch
On 3/14/06, Adam <[EMAIL PROTECTED]> wrote:
> Hopefully that should point you in the right direction to do n-sized
> words as well.
Indeed - as I now have a function:
def nsplit(s, n):
return [s[i:i+n] for i in range(0, len(s), n)]
Incidentally I am currently going with:
def nsplit(s, n):
the level variable in the print statements for proper indentation.
Or something like that,
-Steve
Christopher Spears wrote:
> I am trying to write a function that takes a
> directory's name, finds any subdirectories, and then
> prints out the size of the files in all found
> direct
Hi All,
I had a feeling I could do this:
>>> foo
[[1, 2, 3], [1, 2, 3], [1, 2, 3]]
>>> for c in foo:
... for b in c:
... print b
...
1
2
3
1
2
3
1
2
3
Using a list comprehension, as it seemed to me like I was saying: b
for c in foo, but I can't see how to do this. Ultimately I w
On 3/19/06, Karl Pflästerer <[EMAIL PROTECTED]> wrote:
>>> reduce(lambda s, L: s + sum(L), foo, 0)
Ah ok - well that looks pretty cryptic to me, as I've never used
either lambda or reduce(). However, this looks to be a 'functional'
way of doing what I was doing procedurally, which is, I suppose,
On 3/19/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> What you're doing is called "flattening" a list. You can do it with a
> list comprehension:
>
> >>> foo = [[1,2,3], [4,5,6], [7,8,9]]
> >>> [x for y in foo for x in y]
> [1, 2, 3, 4, 5, 6, 7, 8, 9]
Ah yes, that was the sort of thing I was think
On 3/19/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> > interesting. I've never done any functional programming at all, so it
> > all seems a little foreign!
> >
> > Can you recommend another gentle introduction?
>
> Try the functional programming topic in the Advanced section of my tutor.
> It cov
On 3/27/06, josip <[EMAIL PROTECTED]> wrote:
> Can someone give me exercises to do with loops, maybe functions to?
How about a program that produces truth tables for the basic gates?
AND, NAND, NOT, OR, XOR?
You could write a function for each gate, and one to produce a truth table.
S.
__
r I'll include a GTK
frontend and twisted server.
Does this sound reasonable? Are their any alternatives to Movable
Python? (http://www.voidspace.org.uk/python/movpy/)
Thanks,
-Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 3/29/06, Keo Sophon <[EMAIL PROTECTED]> wrote:
> Is it bitwise operator? Could you give one example?
>>> for a in range(2):
... for b in range(2):
... print a, b, a&b
...
0 0 0
0 1 0
1 0 0
1 1 1
> Sophon
S.
___
Tutor maillist - Tu
On 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote:
> Hi ALL
>
> Just wanted to know the detailed explanation about the below statement
>
> if __name__ == "__main__":
Simple answer - any python program you write is effectively a
'module'. Modules have an attribute __name__. If you've imported
On 3/30/06, Terry Carroll <[EMAIL PROTECTED]> wrote:
> On Wed, 29 Mar 2006, Steve Nelson wrote:
>
> > Simple answer - any python program you write is effectively a
> > 'module'. Modules have an attribute __name__. If you've imported the
> > module fr
ime.
Three additional software packages that help are...
PStart - Shortcuts for USB
Allway Sync - PC to USB sync.
Disc Image XML - take a distribution image and writes a USB stick in
under 2 minutes.
Regards,
-Steve
Michael Sparks wrote:
> On Monday 27 March 2006 22:21, Steve Slevinski wrot
Hello All,
I've been reading about "Inverted Indexing" - I'd like to try to write
something in Python that illustrates the concpet, as I've got to give
a presentation about it.
Where would be a good place to start?
S.
___
Tutor maillist - Tutor@pytho
On 3/31/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Steve Nelson wrote:
>
> Do you need help getting started with Python or with inverted indexing
> in particular?
Sorry - I should have been clearer. I'm reasonably confident in
Python, and if I get stuck with that side
On 4/4/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote:
> Hi ALL
>
> A simple query is that the python mailing List is python powered
>
> What does "python powered" means
The list, and many like it, use a piece of software called Mailman,
which is written in Python. A few years back, the tool of ch
On 4/13/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
>
>
> On Wed, 12 Apr 2006, Hoffmann wrote:
>
> > I read this week on this forum about a kind of Python video in its
> > website. Which view is that, and where could I find it? I search in
> > Python website, but I didn't find it. Is it a 'demo' of th
On 4/13/06, Matthew Singletary <[EMAIL PROTECTED]> wrote:
> I'm NOT looking for any answers, just some tips to an _elegant_ method to
> solve this.
My tutor/mentor and I wrote a chess program a while back - diaganols
were the hardest bit to get working!
Essentially diagonals are treated as thoug
Sorry - including list.
On 4/17/06, Payal Rathod <[EMAIL PROTECTED]> wrote:
> what is the difference between,
>
> def func():
>
>
> and
>
> def func(x):
>
When you define a function, you are writing a block of code which you
can ask to perform a task. The task may be si
On 5/3/06, John Connors <[EMAIL PROTECTED]> wrote:
> G'day,
>
> I know this is a difficult question to answer because it's probably more a
> matter of personal taste than anything else.
It is also a VFAQ. Check the archives - I'm not aware of any radical
new books that would render the most recen
A bunch of my friends and I have been chatting about "99 bottles of
beer" - and how to make the shortest code to do it. I have:
for i in range(100,0,-1):
print "%s bottles of beer on the wall, %s bottles of beer\nTake on
down, pass it around.."%(i,i)
print "Go to the store, buy some more"
I'm
I got a bounce... but have been on this list for months...
S.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi All,
I've just today starting thinking more about programming in a more
functional style, and came across the following article which I
thought was really good:
http://www.amk.ca/python/writing/functional
I know there's a section in Alan's tutorial on FP too, but can anyone
else recommend som
Hello all,
Just started a new job - most of the machines I am administering are
AIX, and don't have Python at all. What is going to me the most
pain-free, scaleable and supportable way of getting Python onto these
machines? I need to take this request to change advisory board.
Also, I could fin
On 7/12/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> According to this page Python binaries for AIX are available. If you
> click through the links, the versions actually available are more recent
> than those listed on the first page.
> http://www.python.org/download/other/
Thanks - that's perf
Hello,
I am reading the "Regular Expression HOWTO" at
http://www.amk.ca/python/howto/regex/
I am at the bit where "greediness" is discussed with respect to
metacharacters enabling repetition of sections of a RE. I understand
the concept.
The author gives a step by step example of how the matchi
On 7/14/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> It doesn't have to match the _whole_ string.
Ah right - yes, so it doesn't say that it has to end with a b - as per
your comment about ending with $.
> If you look at the match object returned, you should se that the match
> starts at position
On 7/14/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> >>> m = re.match(...)
> >>> dir(m)
>
> It will tell you what attributes the match object has.
Useful - thank you.
I am now confuse on this:
I have a file full of lines beginning with the letter "b". I want a
RE that will return the whole line
On 7/14/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> But for this particular application you might as well use
> line.startswith('b') instead of a regex.
Ah yes, that makes sense.
Incidentally continuing my reading of the HOWTO I have sat and puzzled
for about 30 mins on the difference the MULT
Hello there,
I need to be able to compare time on a process tree with system time,
and take action accordingly.
Here's how I get the time on the process tree:
>>> for line in os.popen("ps -ef", "r"):
... if "telnet" in line:
... print line.split()[4]
...
11:00:25
11:01:31
10:01:
On 7/18/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> On 18/07/06, Steve Nelson <[EMAIL PROTECTED]> wrote:
> > What I want to do is establish if the time of the process is *later*
> > than the system date. For example, we might have a process with a
> > time of 11:
tware (ESRI ArcView). Is anyone out there an ESRI user who can tell me if I can I go ahead and download a newer version without messing up my ArcView installation?
Thanks,
Steve
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
t. I have done a little in Visual Basic for Applications but not even that recently. I am in graduate school now for GIS basically and took a course a couple of semesters ago that involved a little Python and it got me interested. I am still basically new to Python.
Thanks again,
cent version, I looked briefly at some of the exchanges on the ESRI site and decided it looked a little tricky at best. I think I might wait for ArcView
9.2 and see what it ships with.
Thanks again,
Steve
On 7/27/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
Steve Haley wrote:> Finally
Hello chums,
How can I go about getting info similar to that which the UNIX df
command provides - of filesystem usage and inode usage? I could just
shell out and run a df command, but I would rather use python
bindings.
What's the recommendation?
S.
_
On 9/22/06, wesley chun <[EMAIL PROTECTED]> wrote:
> this sounds like it will require some work to implement 'df' in
> Python
Mmm... although I have discovered a debian package called pydf whose
source made interesting reading.
> i'd use the one of
> the {os,popen2}.popen*() functions or the sub
Hello,
Is there a way to pull "strings" out of a word document? Not unlike
the way the UNIX command "strings" does?
I want this to be OS-portable, so shelling out is not an option.
I tried opening the word doc and then looking at it using the object's
methods, but it is all binary info, and can
Hi guys,
I am reading and doing examples from Python Web Programming and
Have a question about the dictionary:
counter = {}
file = open("d:\myfile.txt") # the time has come the walrus said
while 1:
line = file.readline()
if line == "":
break
for w in line.split():
if
Thank you! I makes sense now and shows me I need to research more on
file methods.
-Original Message-
From: Bob Gailer [mailto:[EMAIL PROTECTED]
Sent: Friday, December 22, 2006 11:46 AM
To: Steve Oldner
Cc: tutor@python.org
Subject: Re: [Tutor] Lists on the fly?
Steve Oldner wrote
I am learning Python on the office computer which is networked, and am not
allowed to change defaults (programmers aren't allowed to do system admin
stuff, heck, we can't even move our PC's or monitors).
I've got PYTHON installed in d:\python25.
So at the DOS prompt, g:\ type in d:\
Then at
mentalized.
Anyway thanks for the tip and I'll use it next time.
Thanks,
Steve
From: [EMAIL PROTECTED] on behalf of Daniel McQuay
Sent: Sun 12/31/2006 5:43 PM
To: Alan Gauld
Cc: tutor@python.org
Subject: Re: [Tutor] Starting python from a DOS prompt fro
4:11 PM
To: Alan Gauld
Cc: tutor@python.org
Subject: Re: [Tutor] Starting python from a DOS prompt from any directory?
Alan Gauld wrote:
> "Steve Oldner" <[EMAIL PROTECTED]> wrote
>
>> Alan, I work for a state government, so I'm not suppose to
>> downloa
Hello all,
I want to produce stats on file ownership. I am aware that I can use
stat to obtain a file statistics tuple, and with the pwd method I can
convert the UID to username. However, is there a similar method that
will tell me that GID 1 == "staff"?
S.
_
On 1/19/07, Steve Nelson <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I want to produce stats on file ownership. I am aware that I can use
> stat to obtain a file statistics tuple, and with the pwd method I can
> convert the UID to username. However, is there a similar metho
On 9/22/06, Steve Nelson <[EMAIL PROTECTED]> wrote:
> In the end I just did:
>
> def fsUsage(dir):
> """Returns the % usage of a given filesystem"""
> stat = os.statvfs(dir)
> from statvfs import F_BLOCKS, F_BFREE
> total = stat[F
On 1/19/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
> The attribute access uses . notation and an attribute name. You can do
> stat.f_blocks and gstat.gr_gid. Python takes care of looking up the
> actual attribute value.
Excellent - thank you.
> I suggest you use the attribute form for both, it
Hello,
I want to create a dictionary of files and md5sums for a given
directory. It seems, however, that md5 works with strings or
read-only buffers, and can't be passed a file.
What I want to do is something like:
for f is os.listdir("."):
d[f] = someFunctionThatReturnsMD5Sum(f)
Has this wh
Hello,
See below a program that will go through a directory and for each file
print user, group, size and md5sum.
A few questions:
1) It seems to fall over if I pass "." as a directory - how can I stop this?
2) When I wrote the methods I decided to do isafile() checks there,
but subsequently rea
Hello,
I understand the use of xor to do a variable swap without a temporary variable:
>>> x=2
>>> y=3
>>> y=x^y
>>> x=x^y
>>> y=x^y
>>> x
3
>>> y
2
However, why do I see this?
>>> y=x^y
>>> y
1
S.
___
Tutor maillist - Tutor@python.org
http://mail
On 1/29/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
> Because 2 ^ 3 == 1, right? Are you sure you understand what xor does? It
> is a bitwise exclusive or:
Yes... at a binary level, it returns true if either input is true, but not both:
A B Q
0 0 0
0 1 1
1 0 1
1 1 0
Thus it has the effect of swa
Hello all,
I may be about to switch jobs to an environment in which the main
utility language is Ruby. I've found this group to be brilliant in
the last few years, and wondered if anyone on the list is also a Ruby
user, and could recommend a similarly helpful, patient and informative
list?
Thank
Hello,
I have to give a presentation this week on how the MapReduce (of
Google and Hadoop fame) algorithm works.
I understand how map() works, and how reduce() works, and having read
the google papers, I have an idea of their implementation (which I
must say takes certain liberties with FP-derive
On 2/5/07, Steve Nelson <[EMAIL PROTECTED]> wrote:
> What I want to do is now "group" these urls so that repeated urls have
> as their "partner" a lsit of indexes. To take a test example of the
> method I have in mind:
>
> def testGrouper(self):
>
On 2/5/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
> You can also do this operation easily with dicts (not tested!):
Thank you - code now complete and tests passing. Would appreciate
comments / criticisms. I did wonder if I should create a UrlAnalyser
Class rather than have hanging methods:
#!/
Hello chaps,
So further to the MapReduce question, it helped greatly, and I got the
job, so I'll now be programming Ruby for a living...
Before I leave my present job, I've been asked to put together a day's
course on Python for Sysadmins. This is mainly to enable them to
maintain my code, and g
Hi all,
I was playing with some simple HTTP CGI server code
and discovered what I think may be a bug in
CGIHTTPServer.CGIHTTPRequestHandler. A "GET" request
without a leading '/' from a telnet session displays
the CGI script rather than the script's output. If the
request includes the leading '/',
> I was playing with some simple HTTP CGI server code
> and discovered what I think may be a bug in
> CGIHTTPServer.CGIHTTPRequestHandler. A "GET" request
> without a leading '/' from a telnet session displays
> the CGI script rather than the script's output. If >
the
> request includes the leading
.
To print the labels the way I want, I will need extended control over the
printer: positioning the printer precisely and changing fonts, colors, and
background colors. Is there a public python library that could give me this
level of control?
Thanks
Steve
-- Forwarded message --
From: Tim Golden <[EMAIL PROTECTED]>
To:
Date: Wed, 07 Mar 2007 15:48:20 +
Subject: Re: [Tutor] Printing labels
Steve Maguire wrote:
> I am a Python beginner. For my first task I wanted to fix a program
that I
> originally wrote in Excel
ternative solutions.
And one day, I will have free time to work on my "million dollar app."
(LOL!)
Thanks,
Steve Oldner
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kirk Bailey
Sent: Wednesday, March 21, 2007 10:14 PM
To: tutor@python.org
empty, which in a Boolean context is False,
so Python goes on to string2 ('Trondheim') That's non-empty (or True)
so we get that value and don't look further.
non_null = 'Trondheim'
which is a True value. If you said:
if non_null:
print non_null, '
elis aeris wrote:
> is it possible to return two values?
Yes and no. You can return "a" value, but that value may itself be a
tuple of values. Or a list, dictionary or other kind of object.
> how do I create an empy int array of 10?
If an int array has 10 things in it, it's not empty. You do
elis aeris wrote:
> arra = [0] * 10 ?
If you want a list of ten zeroes, yes.
A couple of suggestions:
Find a tutorial introduction to Python such as those on python.org, or
google for "dive into python", and go through the examples in there.
Also, use the interactive Python interpreter to try o
Dinesh B Vadhia wrote:
> I spent fruitless hours trying to get a (normal) division x/y to work and
> then saw that you have to declare:
normal division x/y works just as expected, with one caveat: remember
that if you divide two *integer* values, you will get an *integer*
division operation yield
ySQL directly and executing a SQL statement to import the
data straight in. You'll avoid a host of problems with properly quoting
data (what if a ';' is in one of the data fields?), as well as making it
unnecessary to carry out another post-processing step of gathering this
script
linuxian iandsd wrote:
> ok - as i mentioned in my first email i use procmail to put THE BODY of all
> incoming mail into a file (that is one per incoming email as i use the
> variable $date-$time in the name).
>
> now this file can contain only one email but it can also contain 2 or more
> (this
ate$time
To pipe it to your script, you'd say something like
:0
*Subject:.*pattern to look for
|/home/me/scriptname
For more information see procmailrc(5) and procmailex(5).
Your Python script will see the message input on stdin.
>
> On Wed, Apr 2, 2008 at 7:18 AM, Ste
rsor_object_to_database.execute('insert into webdata field1,
field2, field3, (etc.), field17 values (%s, %s, %s, %s, %s,
(etc.), %s)', *b)
(this is for the MySQLdb module)
Also, how confident are you that the mail format might not be wrong?
Some error checking might be good to
> >>> LeafJawPositions='-42.0001\29.8001'
> >>> LeafJawPositions
> '-42.0001\x029.8001'
> >>> x1, x2 = LeafJawPositions.split('\x0')
> ValueError: invalid \x escape
> >>> x1, x2 = LeafJawP
Thanks!
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Steve Willoughby| Using billion-dollar satellites
[EMAIL PROTECTED] | to hunt for Tupperware.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
abase module will paste in on its own), it will know
to properly quote or escape special characters in those
data values.
Some modules use ? as the place holder, others use %s (even
for numeric values, interestingly enough). Check with
your documentation.
--steve
_
))# square of the sum of the first
why use the list comprehension here, instead of simply saying:
return sum(range(1,101) ** 2
--
Steve Willoughby| Using billion-dollar satellites
[EMAIL PROTECTED] | to hunt for Tupperware.
___
Tutor m
On Tue, May 6, 2008 11:35, Dick Moores wrote:
> Could someone just come right out and do it for me? I'm lost here.
> That '*' is just too magical.. Where did you guys learn about
> '%*s'? Does the '%s' still mean a string?
Python's % operator (for string formatting) is derived from the C standar
ff.
Fixed now :)
And glad to help.
--
Steve Willoughby| Using billion-dollar satellites
[EMAIL PROTECTED] | to hunt for Tupperware.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Thu, May 8, 2008 10:51, Dick Moores wrote:
>
>
> Could someone tell me what's wrong with this regex?
The main thing is that you're forgetting that a RE matches anywhere
in the string.
\b\d+/\d+/\d{2,4}\b matches
4/4/2009
12/12/555
\b\d{1,2}/\d{1,2}\b matches
4/4/2009
4/4/12345
12/12/555
1
er so each number is a word and "2/2/2" will match
> against
> \b\d{1,2}/\d{1,2}\b. The regex only has to match some part of the
> string, not the whole string.
> If you want to match against the full string then use ^ and $ at
> beginning and end of the regex rather tha
On Thu, May 8, 2008 12:40, Dick Moores wrote:
> At 11:46 AM 5/8/2008, Steve Willoughby wrote:
>>Be aware that \d{2,4} matches 2, 3 or 4 digits, which may be
>>different than what you're looking for, since 1/12/234 would
>>match
>
> Yes, I wanted to permit that. In
On Thu, May 8, 2008 14:40, Dick Moores wrote:
> At 01:30 PM 5/8/2008, Steve Willoughby wrote:
>>On Thu, May 8, 2008 12:40, Dick Moores wrote:
>> > But here's a chance to ask: What regex would match 2-digit strings
>> > and 4-digit strings only?
>>
>>^\
On Thu, May 8, 2008 16:32, Steve Willoughby wrote:
> On Thu, May 8, 2008 14:40, Dick Moores wrote:
>> At 01:30 PM 5/8/2008, Steve Willoughby wrote:
>>>On Thu, May 8, 2008 12:40, Dick Moores wrote:
>>> > But here's a chance to ask: What regex would match 2-digi
Dick Moores wrote:
At 04:32 PM 5/8/2008, Steve Willoughby wrote:
On Thu, May 8, 2008 14:40, Dick Moores wrote:
> At 01:30 PM 5/8/2008, Steve Willoughby wrote:
>>On Thu, May 8, 2008 12:40, Dick Moores wrote:
>> > But here's a chance to ask: What regex would match 2-digit s
> From: [EMAIL PROTECTED]
> To: tutor@python.org
> Date: Tue, 3 Jun 2008 15:39:18 -0400
> Subject: [Tutor] env variable
>
> have a question about setting up an env. variable.
> i own a macbook pro laptop running mac os x 10.5.2.
> i downloaded MacPython 2.5.
> my
Shrutarshi Basu wrote:
I've been writing a simple Tkinter interface to one of my programs.
But it looks rather bad on OS X leopard. I was wondering why that was
the case, since it seemed to take up at least some GUI elements (like
button styles). I then came upon the following page:
http://develo
101 - 200 of 397 matches
Mail list logo