On 18/07/2006 11:17 PM, guthrie wrote:
> Beginner question! :-)
>
> x=[1,2,3,4]
> for i in range(len(x)):
>print x[:-i]
>
> >>> []
> >>> [1,2,3]
> >>> [1,2]
> >>> [1]
>
> 1) The x[:-0] result seems inconsistent to me;
> I get the idea that -0=0, so it is taken as x[:0] -> []
> 2) how
On 19/07/2006 1:05 AM, Dan Bishop wrote:
> Paul Boddie wrote:
>
>> Yes, he wants range to return an iterator, just like xrange more or
>> less does now. Given that xrange objects support __getitem__, unlike a
>> lot of other iterators (and, of course, generators), adding
>> __contains__ wouldn't b
On 19/07/2006 5:34 AM, [EMAIL PROTECTED] wrote:
> >> In csv.reader, is there any way of skip lines that start whith '#' or
> >> empty lines
>
> Nope. When we wrote the module we weren't aware of any "spec" that
> specified comments or blank lines. You can easily write a file wrapper to
>
On 20/07/2006 1:58 AM, [EMAIL PROTECTED] wrote:
> Hi,
>
> I'm new at python as I just started to learn it, but I found out
> something weird. I have wrote a little program to compute Mersenne
> number:
>
> # Snipet on
> def is_prime n:
Syntax error. Should be:
def is_prime n:
> for i in
On 20/07/2006 6:05 AM, John Machin wrote:
> On 20/07/2006 1:58 AM, [EMAIL PROTECTED] wrote:
>> def is_prime n:
>
> Syntax error. Should be:
>def is_prime n:
Whoops! Take 2:
Should be:
def is_prime(n):
--
http://mail.python.org/mailman/listinfo/python-list
On 20/07/2006 5:18 PM, Steve Holden wrote:
> Anoop wrote:
>> Hi All
>>
>> Can any one help me out with the various depricated string functions
>> that is followed in Python.
>>
>> For example how will be string.lower depricated.
>>
>> As far as string.lower('PYTHON') is concerned it is depricated a
On 22/07/2006 9:25 AM, John Machin wrote:
Apologies if this appears twice ... post to the newsgroup hasn't shown
up; trying the mailing-list.
> On 22/07/2006 2:18 AM, Simon Forman wrote:
>> John Salerno wrote:
>>> Simon Forman wrote:
>>>
>>>> Pytho
rsd wrote:
> Hi,
>
> I'm trying get Samsung YH-920 mp3 player to work with Debian GNU/Linux.
> To do that I need to run
>http://www.paul.sladen.org/toys/samsung-yh-925/yh-925-db-0.1.py
> script, the idea behind the script is described at
>http://www.paul.sladen.org/toys/samsung-yh-925/
>
>
Jim wrote:
> [EMAIL PROTECTED] wrote:
> > Hello,
> >
> > For my application, I would like to execute an SQL query like this:
> > self.dbCursor.execute("INSERT INTO track (name, nbr, idartist, idalbum,
> > path) VALUES ('%s', %s, %s, %s, '%s')" % (track, nbr, idartist,
> > idalbum, path))
> No, I'll
[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
> > I tried to encode the different variables in many different encodings
> > (latin1), but I always get an exception. Where does this ascii codec
> > error comes from? How can I simply build this query string?
>
> Raphael,
>
> The 'ascii' encodin
bugnthecode wrote:
> I'm writing a program to send data over the serial port. I'm using
> pyserial, and I'm on WindowsXP. When I use literals I can get the data
> accross how I want it for example:
>
>1 2 3 4 5 6
> serialport.write('!SC'+'\x01'+'\x05'+'\xF
Lurker wrote:
> I want send latin-1 string to web server by url parameter
>
> urllib.quote return just symbol code with preceeding percent for every
> non-ascii character:
> #>ustr = 'Ü'
> #>urllib.quote(ustr)
> '%9A'
>
The latin1 encoding for U-with-umlaut is 0xDC.
The cp850 encoding for the sam
(localpsc):
> """Gets the version from the PSC. Mainly just to verify a
> connection"""
>
> localpsc.write('!SCVER?\r')
> localpsc.read(8) #Discard the echo!
> s = localpsc.read(3)
> print s
>
> def moveServo(localpsc,
Jim wrote:
> John Machin wrote:
> > Jim wrote:
> > > No, I'll bet that you'd like to run something like
> > > self.dcCursor.execute("INSERT INTO track (name, nbr, idartist,
> > > idalbum,path) VALUES (%(track)s, %(nbr)s,
> > > %(id
James Stroud wrote:
> walterbyrd wrote:
> > This is the first real python program I have ever worked on. What I
> > want to do is:
> > 1) count identical records in a cvs file
> > 2) create a new file with quantities instead duplicate records
> > 3) open the new file in ms-excel
> >
> > For exampl
koara wrote:
> Hello, it might be too late or too hot, but i cannot work out this
> behaviour of find_longest_match() in difflib.SequenceMatcher:
>
> string1:
[snipped 500-byte string]
>
> string2:
>
[snipped 500-byte string]
>
> find_longest_match(0,500,0,500)=(24,43,10)="version01t"
>
> What? O_
Markus wrote:
> You know you're guilty of early/over optimisation, when it's almost two
> in the morning and the file open in front of you reads as follows.
>
> The code you are about to read is real...
> Some of the variable names have been changed
> to protect the families of those involved
Tim Chase wrote:
[snip]
> As
> such, I'd rework the move() function I suggested to simply be
> something like
>
> def move(rate,lo,hi,chan=1):
> return "!SC%c%c%c%c\r" % (chan, rate, lo, hi)
>
> where you possibly even just pass in the "position" parameter,
> and let the function do the spl
[EMAIL PROTECTED] wrote:
> the starting and ending deliminators are ASCII 'STX' and 'ENX'. i
> wondered why they did it like that also. But they did.
>
> the message length is a 4 byte integer indicating how long the message
> body is.
> the message type is also 4 bytes. There is a table in the d
Grant Edwards wrote:
> On 2006-07-24, Steve Holden <[EMAIL PROTECTED]> wrote:
> > [EMAIL PROTECTED] wrote:
> >
> >> now the 17758 is significant because it is the actual unit number of
> >> the machine we want to monitor. I just dont know how to extract the
> >> real values out of this message.
>
koara wrote:
> John Machin wrote:
> > --test results snip---
> > Looks to me like the problem has nothing at all to do with the length
> > of the searched strings, but a bug appeared in 2.3. What version(s)
> > were you using? Can you reproduce your results (500 & 4
John Machin wrote:
> koara wrote:
> > John Machin wrote:
> There is a bug.
> I'll report it.
Reported.
http://sourceforge.net/tracker/index.php?func=detail&aid=1528074&group_id=5470&atid=105470
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> ok. indeed i did do '' instead of ' '.
> here is an example of a message
> 'STX\x00\x00\x004\x00\x00\x00\xc8stateman\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00state1man\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00ENX'
>
> tohex gave me '53
Steve Jobless wrote:
> Hi,
>
> I just started learning Python. I went through most of the tutorial at
> python.org. But I noticed something weird. I'm not talking about the
> __private hack.
>
> Let's say the class is defined as:
>
> class MyClass:
> def __init__(self):
> pass
> def
Anoop wrote:
> Hi All
>
> I am getting two different outputs when i do an operation using
> string.digits and test.isdigit(). Is there any difference between the
> two.
Your first sentence appears to answer that ..but yes, there's quite a
difference. Have you read the manual?
> I have given the
On 22/07/2006 2:18 AM, Simon Forman wrote:
> John Salerno wrote:
>> Simon Forman wrote:
>>
>>> Python's re.match() matches from the start of the string, so if you
(1) Every regex library's match() starts matching from the beginning of
the string (unless of course there's an arg for an explicit s
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, nephish wrote:
>
> > tohex gave me
> > '53 54 58
>
>S T X
>
> > 00 00 00 34
>
> Length!? Decimal 57.
3 * 16 + 4 -> 52 where I come from -- assuming hex means hexadecimal
and not witchcraft :-)
>
> > 00 00 00 c8
>
> Type!? Decimal 2
Erik Max Francis wrote:
> alex23 wrote:
>
> > The standard library module 'libcache' does exactly what you're
> > considering implementing.
>
> I believe the module you're referring to is `linecache`.
>
and whatever its name is, it's not a goer: it reads the whole of each
file into memory. It was
thebjorn wrote:
> For the purpose of finding someone's age I was looking for a way to
> find how the difference in years between two dates, so I could do
> something like:
>
> age = (date.today() - born).year
>
> but that didn't work (the timedelta class doesn't have a year
> accessor).
>
> I loo
Bruno Desthuilliers wrote:
> thebjorn wrote:
> > For the purpose of finding someone's age I was looking for a way to
> > find how the difference in years between two dates, so I could do
> > something like:
> >
> > age = (date.today() - born).year
> >
> > but that didn't work (the timedelta class
Bruno Desthuilliers wrote:
> John Machin wrote:
> > Bruno Desthuilliers wrote:
>
> >
> > Which pieces of the following seem to be working to you?
>
> John, it seems you failed to notice the use of "may" and "seems" in my
> post. IIRC, both
thebjorn wrote:
> John Machin wrote:
> > thebjorn wrote:
> [...]
> > >
> > > def age(born):
> > > now = date.today()
> > > birthday = date(now.year, born.month, born.day)
> >
> > Bad luck if the punter was born on 29 Feb
Michael Yanowitz wrote:
> Hello:
>
> For some reason I can't figure out how to split
> a 4-byte (for instance) float number (such as 3.14159265359)
> into its 4-bytes so I can send it via a socket to another
> computer.
> For integers, it is easy, I can get the 4 bytes by anding like:
> byte1
[EMAIL PROTECTED] wrote:
> Hello,
>
> I have some lists for which I need to remove duplicates. I found the
> sets.Sets() module which does exactly this
I think you mean that you found the sets.Set() constructor in the set
module.
If you are using Python 2.4, use the built-in set() function instead
Simon Forman wrote:
>
> Do ','.join(clean) to make a single string with commas between the
> items in the set. (If the items aren't all strings, you'll need to
> convert them to strings first.)
>
And if the items themselves could contain commas, or quote characters,
you might like to look at the
[EMAIL PROTECTED] wrote:
> I know this is a trivial function, and I've now spent more time
> searching for a surely-already-reinvented wheel than it would take to
> reinvent it again, but just in case... is there a published,
> open-source, function out there that takes a string in the form of
> "h
[EMAIL PROTECTED] wrote:
> HI,
>
> I'm having trouble writing to a MySql db using python and the MySQLdb
> module. Here is the code:
>
> import MySQLdb
> base = MySQLdb.connect(host="localhost", user="blah", passwd="blah",
> db="test_py")
> cursor = base.cursor()
> cursor.execute("INSERT INTO table
Ray wrote:
> The argument against this is that since development with Python is so
> rapid, you're supposed to always equip your code with extensive unit
> tests. I like Python but I've never really bought that argument--I
> guess I've been doing Java too long :)
>
In Java, if you don't always e
[EMAIL PROTECTED] wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> > > HI,
> > >
> > > I'm having trouble writing to a MySql db using python and the MySQLdb
> > > module. Here is the code:
> > >
> > > import MySQLdb
>
thebjorn wrote:
> John Machin wrote:
> > thebjorn wrote:
> > > John Machin wrote:
> > > > thebjorn wrote:
> [...]
> > > > Holy code bloat, Batman! Try this:
> > > >
> > > > return now.year - born.year - (birthday
Sibylle Koczian wrote:
> John Machin schrieb:
> >
> > BTW, if the script doesn't contain
> >
> > base.commit()
> >
> > somewhere, take yourself out to the back lane and give yourself a good
> > thumping :-)
>
> That's not really
[EMAIL PROTECTED] wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> > > I know this is a trivial function, and I've now spent more time
> > > searching for a surely-already-reinvented wheel than it would take to
> > > reinvent it again,
Asem Eltaher wrote:
> Dear users,
> I use Python version 2.4.3 and DyBase Object Oriented Database. These
> are the first three lines in my program:
>
> import os
> import sys
> import dybase
>
> I usually get the error message: ImportError: DLL load failed. Kindly
> be informed that I have in t
thebjorn wrote:
> John Machin wrote:
> > thebjorn wrote:
> [...]
> > > You give a good argument that the concept of a month is fuzzy
> >
> > Sorry, I can't imagine where you got "fuzzy" from. Perhaps you mean
> > some other word. The concep
[EMAIL PROTECTED] wrote:
>
> Thanks for the thumping, will try harder next time.
> _
>
> Thanks for commit comment i think that whats i need.
> _
>
> I think you should support people rather than pay
Chaos wrote:
> As my first attempt to loop through every pixel of an image, I used
>
> for thisY in range(0, thisHeight):
> for thisX in range(0, thisWidth):
> #Actions here for Pixel thisX, thisY
OT: you don't need the 0 in the range call. Taking it out does
Daniel Mark wrote:
>
> Also, I list some screen shot from my machine as follows:
>
> C:\Program Files\Python24>cd \
>
> C:\>python
Note: *no* error message !!! [or you edited the screen shot]
Hypothesis: there is something called python.exe or python.bat or
whatever somewhere in your path b
[EMAIL PROTECTED] wrote:
> Hi,
> My string is a multi line string that contains "filename
> \n" and "host \n" entries among other things.
>
> For example: s = """ filename X
> host hostname1
> blah...
> host hostname2
>
Terry Reedy wrote:
> "Chaos" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >> > As my first attempt to loop through every pixel of an image, I used
> >> >
> >> > for thisY in range(0, thisHeight):
> >> > for thisX in range(0, thisWidth):
> >> >
thebjorn wrote:
> John Machin wrote:
> > Jan 31 to Feb 27: 27d (ex) 28d (in)
> > Jan 31 to Feb 28: 28d (ex) 1m 1d (in)
> > Jan 31 to Mar 01: 1m 1d (ex) 1m 2d (in)
> > So 1 day short of 1m 1d is not 1m 0 d???
>
> Exactly. Just as a person born on 1999-3-1 isn'
mp wrote:
> Is there a constructor for an mx.DateTime object which takes a
> datetime.datetime object? It seems like a pretty common thing to do but
> I didn't see such a constructor in the mx.DateTime docs.
>
1. It's very strange that you got the impression from the mx docs that
the author was a
Daniel Mark wrote:
> Dear John:
>
> > Have a look in each of those folders (including the root!!) and see
> > what you find there. [If I were forced to bet, I'd put my money on
> > cygwin].
>
> You are a genius!!!
No, it was just a matter of noticing that the dog didn't bark :-)
>
> My machine w
[EMAIL PROTECTED] wrote:
> OK, I tried this one. I am actually trying to parse dhcpd.conf file.
>
> def get_filename(self):
> p = "^[ \t]*filename[ \t]+(\S+).*?host[ \t]+%s\s*$" % self.host
> pat = re.compile(p, re.MULTILINE | re.DOTALL)
> mo = pat.search(self.confdata)
> if mo:
>
Philippe Martin wrote:
> Hi,
>
> I'm looking for an algo that would convert a list such as:
Such as what?
>
> I'm using python to prototype the algo: this will move to C in an embedded
> system where an int has 16 bits - I do not wish to use any python library.
>
> l1 = [1,2,3,4,6,7,8] #represent
Philippe Martin wrote:
> John Machin wrote:
>
> > Philippe Martin wrote:
> >> Hi,
> >>
> >> I'm looking for an algo that would convert a list such as:
> >
> > Such as what?
> >
> >>
> >> I'm using python to protot
Philippe Martin wrote:
>
> Thanks John, I do not have a long available on the device: stuck with 16
> bits.
>
What does "available on the device" mean? Having a "long" is a property
of a C complier, not a device. What is the CPU in the device? What is
the C compiler you are using? N.B. Last time
Philippe Martin wrote:
> John Machin wrote:
>
> > Philippe Martin wrote:
> >
> >>
> >> Thanks John, I do not have a long available on the device: stuck with 16
> >> bits.
> >>
> >
> > What does "available on the device"
Philippe Martin wrote:
> Philippe Martin wrote:
>
> > Hi,
> >
> > I'm looking for an algo that would convert a list such as:
> >
> > I'm using python to prototype the algo: this will move to C in an embedded
> > system where an int has 16 bits - I do not wish to use any python library.
> >
> > l1
Philippe Martin wrote:
> John Machin wrote:
>
> > Have you considered asking on a newsgroup where your problem might
> > actually be on-topic, like:
> > comp.lang.c
>
> Yes, I came here for the "algorithm" question, not the code result.
>
This is
Philippe Martin wrote:
> John Machin wrote:
>
> >
> > Philippe Martin wrote:
> >> Philippe Martin wrote:
> >>
> >> > Hi,
> >> >
> >> > I'm looking for an algo that would convert a list such as:
> >> >
> &
Philippe Martin wrote:
> John Machin wrote:
>
> >
> > Philippe Martin wrote:
> >> John Machin wrote:
> >>
> >> > Have you considered asking on a newsgroup where your problem might
> >> > actually be on-topic, like:
> >> >
Claudio Grondi wrote:
> [EMAIL PROTECTED] wrote:
> > Claudio Grondi wrote:
> >
> >>[EMAIL PROTECTED] wrote:
> >>
> >>>Here is my script:
> >>>
> >>>from mechanize import *
> >>>from BeautifulSoup import *
> >>>import StringIO
> >>>b = Browser()
> >>>f = b.open("http://www.translate.ru/text.asp?lang
Philippe Martin wrote:
> >> 3. How does the device manage to compute the 8-decimal-digit number
> >> that is your input??
>
> What device manager ? think about it before being rude
>
No device manager [noun] was mentioned. You may have inferred rudeness
where astonishment was being implied.
Philippe Martin wrote:
>
> Yes I had arm in mind (for some reason) while it is the Smc8831
> (http://www.google.com/url?sa=U&start=1&q=http://www.epsondevice.com/www/PDFS/epdoc_ic.nsf/5388db40b5eee4f949256a9c001d589f/944b73008b0bad33492570a00015d6ba/%24FILE/S5U1C88000C_2Ev3.pdf&e=9797)
That appea
Jonathan Bowlas wrote:
> Hi Listers,
>
> I have a requirement to test for a data type could someone tell me if this
> is possible in python?
>
> Basically I have a ZPT in Zope that users can select checkboxes in a form
> which pass arguments for a python function, however if there is only one
> che
[EMAIL PROTECTED] wrote:
> Philippe Martin wrote:
> > Yes, I came here for the "algorithm" question, not the code result.
>
> To turn BCD x to binary integer y,
>
> set y to zero
> for each nibble n of x:
> y = (((y shifted left 2) + y) shifted left 1) + n
Yeah yeah yeah
i.e. y = y * 10 +
Philippe Martin wrote:
> Paul Rubin wrote:
>
> > Philippe Martin <[EMAIL PROTECTED]> writes:
> >> I actually need numbers much larger than 32 bits.
***NOW*** you tell us, after all the stuffing about re 32 bits.
> >
> > What is the max size hex number you need? What is the application if
> > yo
shakir wrote:
> HI All,
>
> I need help for inserting recods into the access database using python
> script through ODBC. I can insert data without any problem if I hard
> coded the run_Date field. But I need run_Date field should be mytime..
> I am getting error Data type mismatch in criteria exp
Philippe Martin wrote:
> John Machin wrote:
>
> > So why don't you get a freely available "bignum" package, throw away
> > the bits you don' t want, and just compile it and use it, instead of
> > writing your own bug-ridden (see below) routines? Oh
BartlebyScrivener wrote:
> John Machin wrote:
>
> >> or mxODBC
> >> [very good but not free].
>
> I love mxODBC. It's free for noncommercial use.
>
I was presuming that the OP was mucking about with Access only because
he was so constrained by his job :
Philippe Martin wrote:
> Sorry forgot a few answers/comments:
>
> John Machin wrote:
> > SHOULD BE >=
> >currently add([6, 6], [4, 4] -> [10, 10]
>
> True, thanks
>
> > *** try - 10 instead of % 10
> > If the first operand is > 19, you have
David Bear wrote:
> I must have missed reading something important about naming conventions.
>
> I have found that if I have a python module where I have an identifier named
> with a beginning underscore that I cannot use from module import * to make
> that name available in another module.
>
> fo
Simon Forman wrote:
> Philippe, please! The suspense is killing me. What's the cpu!?
>
> For the love of God, what's the CPU?
>
> I-can't-take-it-anymore-it's-such-a-simple-question-ingly yours,
Yes, please .
I've found a C compiler manual on the web for the Epson S1C33 CPU as
well as the
Grant Edwards wrote:
> On 2006-08-01, Philippe Martin <[EMAIL PROTECTED]> wrote:
>
> >> Perhaps if Philippe could divulge the part number that's in
> >> the bottom right corner of the manual that he has, and/or any
> >> part number that might be mentioned in the first few pages of
> >> that manual
crystalattice wrote:
>
> Plus, to modify data in a class
I presume the word "instance" is missing here ...
> do I have to unpickle the whole thing
> first or is there a way to modify the data while it's pickled? Actually,
> I think I can answer that last question: a character instance, having
[EMAIL PROTECTED] wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> > > Philippe Martin wrote:
> > > > Yes, I came here for the "algorithm" question, not the code result.
> > >
> > > To turn BCD x to binary integer y,
[EMAIL PROTECTED] wrote:
>My version assumes three subroutines: extracting
> nibbles, shifting, and adding, Those are pretty simple, so I asked
> if he needed them rather than presenting them.
> Assuming we have
> them, the algorithm is three lines long.
Perhaps you could enlighten us by publishi
Avell Diroll wrote:
> beno wrote:
> > I have to rebuild
> > python. [snip] Platform is FreeBSD 5.? I have
> > the following questions:
> >
> > What is meant by pointing to this folder thus:
> > ./configure --prefix=/usr/python
> >
> > When I run make test I get these errors:
> >
> *** errors ***
jeremito wrote:
> I am extending python with C++ and need some help. I would like to
> convert a string to a mathematical function and then make this a C++
> function. My C++ code would then refer to this function to calculate
> what it needs. For example I want to tell my function to calculate
[EMAIL PROTECTED] wrote:
> John Machin wrote:
> > [EMAIL PROTECTED] wrote:
> >
> > >My version assumes three subroutines: extracting
> > > nibbles, shifting, and adding, Those are pretty simple, so I asked
> > > if he needed them rather than presenting th
Lad wrote:
> Sybren Stuvel wrote:
> > Lad enlightened us with:
> > > How can I find days and minutes difference between two datetime
> > > objects?
> > > For example If I have
> > > b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000)
> > > a=datetime.datetime(2006, 8, 1, 18, 19, 45, 765000)
> >
>
BartlebyScrivener wrote:
> Stand and fight, Python brothers. Fear not, the Ruby horde!
>
> From this day to the ending of the world,
> But we in it shall be remember'd;
> We few, we happy few, we band of brothers;
> For he to-day that sheds his blood with me
> Shall
Something strange possessed Tim Chase and caused him to write:
> def findClosest(dataset, target):
[subtly *BUGGY* and overly verbose]
> def findClosest2(dataset, target):
[evil]
Try this (tested to the extent shown):
C:\junk>type dict_closest.py
def findClosest(dataset, target):
[snip]
def find
Christoph Haas wrote:
> I assume that XQuery can't to weird queries like IP ranges, or can it?
That's twice now you've indicated that IP ranges are causing you some
problems. What's the big deal?
(a) If you don't have a specialised data type, just parse an IP address
into an unsigned 32-bit int
[EMAIL PROTECTED] wrote:
> This is a bit of a peculiar problem. First off, this relates to Python
> Challenge #12, so if you are attempting those and have yet to finish
> #12, as there are potential spoilers here.
>
> I have five different image files shuffled up in one big binary file.
> In order
Tim Roberts wrote:
> What is your signature supposed to be? It looks like you are trying to
> inject ANSI terminal escape sequences. The vast majority of Usenet
> participants are now reading these articles through GUI newsreaders or
> web-based readers which show this as 5 lines of unrecognizab
taleinat wrote:
> Gabriel Murray gmail.com> writes:
>
> >
> > Hello, I'm looking for a regular expression which will match strings as
> follows: if there are symbols a, b, c and d, then any pattern is valid if it
> begins with a and ends with d and proceeds in order through the symbols.
> However
Slawomir Nowaczyk wrote:
> On Thu, 03 Aug 2006 22:10:55 +0100
> Gabriel Murray <[EMAIL PROTECTED]> wrote:
>
> #> Hello, I'm looking for a regular expression
>
> Some people, when confronted with a problem, think "I know, I'll
> use regular expressions." Now they have two problems.
>
Chris wrote:
> It's very beautiful. Thanks
You think that's beautiful? Try these:
'abcdef'[::-1]
'abcdef'[::-2]
Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Jim, what you wrote should work correctly. I'm curious as to why you
> are doing it this way though. An easier way would be to take out all
> this character processing and use the builtin string processing.
I'm curious as to why Jim is doing it at all.
Extract from C:\
Jon Smirl wrote:
> Is there some way to tell a dictionary object that I am going to load 1M
> objects into it and have it pre-allocate enought slots to hold all of the
> entries?
Not according to the manual.
Not according to the source [as at 2.4.3]. In any case, if there were a
back-door undocum
danielx wrote:
> No offense. I didn't mean there was anything wrong with your way, just
> that it wasn't "neat". By that, I meant, you were still using lots of
> for loops and if blocks.
>
> Justin Azoff wrote:
> > danielx wrote:
> > > I'm surprised no one has mentioned neat-er, more pythonic ways
Dennis Benzinger wrote:
> Is there a library with a strftime replacement which supports Unicode
> format strings?
>
Not that I know of.
I presume that you're not happy with workarounds like:
#>>> import datetime
#>>> now = datetime.datetime.now()
#>>> now.strftime('Year=%Y Month=%m Day=%d')
'Yea
[EMAIL PROTECTED] wrote:
> I'm using the ID3 tag of an mp3 file to query musicbrainz to get their
> sort-name for the artist. A simple example is "The Beatles" ->
> MusicBrainz -> "Beatles, The". I then want to rename the mp3 file
> using this information. However, I would like the filename to c
Lad wrote:
> Hello,
> what is the best /easest way how to get number of hours and minutes
> from a timedelta object?
> Let's say we have
> aa=datetime.datetime(2006, 7, 29, 16, 13, 56, 609000)
> bb=datetime.datetime(2006, 8, 3, 17, 59, 36, 46000)
> so
> c=bb-aa
> will be
> datetime.timedelta(5, 63
Ant wrote:
> John Machin wrote:
> > Lad wrote:
> > > Hello,
> > > what is the best /easest way how to get number of hours and minutes
> > > from a timedelta object?
> ...
> > >>> diff.days
> > 0
> > >>> diff.seconds
>
Ant wrote:
> John Machin wrote:
> ...
> > 1. If that's what he wanted, it was a very peculiar way of asking. Do
> > you suspect that he needs to be shown how to conver 877.7... minutes
> > into hours, minutes and seconds???
>
> Chill dude, It wasn't an att
Hitesh wrote:
> Hi,
>
> I have a small script here that goes to inside dir and sorts the file
> by create date. I can return the create date but I don't know how to
> find the name of that file...
> I need file that is not latest but was created before the last file.
> Any hints... I am newbiw pyth
infidel wrote:
> Where are they-who-hate-us-for-our-whitespace? Are "they" really that
> stupid/petty? Are "they" really out there at all? "They" almost sound
> like a mythical caste of tasteless heathens that "we" have invented.
All societies demonise outsiders to some extent. It's an unfortu
Ben Finney wrote:
> Howdy all,
>
> Question: I have Python modules named without '.py' as the extension,
> and I'd like to be able to import them. How can I do that?
>
> Background:
>
> On Unix, I write programs intended to be run as commands to a file
> with no extension. This allows other progra
401 - 500 of 3076 matches
Mail list logo