Re: Pythonic love
justin walterswrites: > Sorry about the top posting. I'm new to mailing lists. I should just reply > to the python-list@python.org address then? > > Also, thank you for the generator clarification. > On Mar 8, 2016 9:09 AM, "jmp" wrote: ^ that's top posting always reply inline or at the bottom -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Book for a C Programmer?
On 2012-05-24, alister alister.w...@ntlworld.com wrote: On Wed, 23 May 2012 16:45:05 -0700, hsaziz wrote: I am trying to join an online class that uses python. I need to brush up on the language quickly. Is there a good book or resource that covers it well but does not have to explain what an if..then..else statement is? Thanks. Dive into python seems to be quite popular can be read online fro free Learning Python by Mark Lutz, from O'Reilly is a good one, I've been reading it and it also enforces a comparison between C programming and Python. However, it's focused on Python 2, but it also mentions Python 3 things in the text... -- Javier Novoa C. --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Book for a C Programmer?
On Thu, May 24, 2012 at 08:34:24AM -0500, boB Stepp wrote: On Thu, May 24, 2012 at 8:28 AM, Javier Novoa C. jsti...@invernalia.homelinux.net wrote: On 2012-05-24, alister alister.w...@ntlworld.com wrote: On Wed, 23 May 2012 16:45:05 -0700, hsaziz wrote: I am trying to join an online class that uses python. I need to brush up on the language quickly. Is there a good book or resource that covers it well but does not have to explain what an if..then..else statement is? Thanks. Dive into python seems to be quite popular can be read online fro free Learning Python by Mark Lutz, from O'Reilly is a good one, I've been reading it and it also enforces a comparison between C programming and Python. However, it's focused on Python 2, but it also mentions Python 3 things in the text... There is a new edition out, copyright 2010 if I recall correctly, that updates its coverage to Python 3.x, which is the book's primary focus, though it points out where 3.x syntax does not work in version 2.x. Cheers! boB Oh thanks! that I didn't knew... -- Javier Novoa C. -- http://mail.python.org/mailman/listinfo/python-list
strptime format string nasty default
Hi, I am using time.strptime method as follows: I receive an input string, representing some date in the following format: %d%m%Y However, the day part may be a single digit or two, depending on magnitude. For example: '10052012' will be parsed as day 10, month 5, year 2012 Again: '8052012' will be parsed as day 8, month 5, year 2012 What happens when day is 1 or 2? '1052012' will be parsed as day 10, month 5, year 2012 That's not the expected behaviour! Not for me at least. I mean, in my case, month will always be a 2 digit string, so there's no ambiguity problem by pretending that... say '1052012' is correctly parsed. Is there a way out of here? I know I can pre-parse the string and append a '0' to it when lenght == 7, but I think that a better way would be if strptime allowed me to define my format in a better way... To say that the month is the optional one-two digit part is just a default, isn't it? Why can't I specify that the day part is the one with one-or-two digits on the input string...? Or is there a way out that I don't know yet? -- Javier Novoa C. --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list
Re: strptime format string nasty default
On 2012-05-09, Jorgen Grahn grahn+n...@snipabacken.se wrote: You'd have to read the strptime(3) manual page (it's a Unix function, imported straight into Python, I'm sure). Judging from a quick read it's not intended to support things like these. I'm surprised it doesn't parse your last example to (10, 52, 12) and then fail it due to month12. Well, it doesn't, at least on my Python. I'm using 2.7.3 version Can't you use a standard date format, like ISO? Apart from not being possible to parse with standard functions, this one looks quite odd and isn't very human-readable. No, sadly the input doesn't depends on me :-( If you have to use this format, I strongly recommend parsing it manually as text first. Then you can create an ISO date and feed that to strptime, or perhaps use your parsed (day, month, year) tuple directly. Ok, I'll do that. /Jorgen Thanks! -- Javier Novoa C. --- Posted via news://freenews.netfront.net/ - Complaints to n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list