Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Steven D'Aprano
On 07/10/12 13:37, Richard D. Moores wrote: On Sat, Oct 6, 2012 at 5:22 PM, eryksun wrote: >>> from datetime import date >>> date(2014, 2, 18).strftime("%A") 'Tuesday' http://docs.python.org/library/datetime#strftime-and-strptime-behavior Or for Python 3.3,

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Brian van den Broek
On 6 Oct 2012 22:40, "Richard D. Moores" wrote: > I remain bewildered. Where did these strangely named things come from, > strftime and strptime? I see that Hi Dick, These names carry over from well entrentched names from C. My guess is format time and print time are what they are supposed to

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread eryksun
On Sat, Oct 6, 2012 at 10:37 PM, Richard D. Moores wrote: > On Sat, Oct 6, 2012 at 5:22 PM, eryksun wrote: > >> >>> from datetime import date >> >>> date(2014, 2, 18).strftime("%A") >> 'Tuesday' >> >> http://docs.python.org/library/datetime#strftime-and-strptime-behavior > > I remain

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Richard D. Moores
On Sat, Oct 6, 2012 at 6:50 PM, Steven D'Aprano wrote: > On 07/10/12 12:08, Richard D. Moores wrote: >> >> On Sat, Oct 6, 2012 at 4:42 PM, Mark Lawrence >> wrote: >> >>> Use calendar.day_name. >> >> >> How? > > > By reading the Fine Manual. > > http://docs.python.org/library/calendar.html#calendar

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Richard D. Moores
On Sat, Oct 6, 2012 at 5:22 PM, eryksun wrote: > >>> from datetime import date > >>> date(2014, 2, 18).strftime("%A") > 'Tuesday' > > http://docs.python.org/library/datetime#strftime-and-strptime-behavior Or for Python 3.3,

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread akleider
> On 10/06/2012 07:19 PM, Richard D. Moores wrote: >> On Fri, Oct 5, 2012 at 7:15 AM, Walter Prins wrote: >> >>> Does this hint help? >>> >> import datetime >> mydate = datetime.date(2012,10,5) >> mydate = mydate + datetime.timedelta(days=30) >> print mydate >>> 2012-11-04 >> Yes!

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Steven D'Aprano
On 07/10/12 12:13, Richard D. Moores wrote: On Sat, Oct 6, 2012 at 4:35 PM, Alan Gauld wrote: On 07/10/12 00:19, Richard D. Moores wrote: That "1" means Tuesday, right? But how can I use calendar to print out that word, "TUESDAY"? days = ("Monday", "Tuesday", "Wednesday",

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Steven D'Aprano
On 07/10/12 12:08, Richard D. Moores wrote: On Sat, Oct 6, 2012 at 4:42 PM, Mark Lawrence wrote: Use calendar.day_name. How? By reading the Fine Manual. http://docs.python.org/library/calendar.html#calendar.day_name which is so short that I can copy it here: calendar.day_abbr An arr

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Dave Angel
On 10/06/2012 09:10 PM, Richard D. Moores wrote: > On Sat, Oct 6, 2012 at 4:29 PM, Dave Angel wrote: > >> To turn an integer (0-6, or whatever) into a string, just use a tuple of >> the same size: >> >> tran = ("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", >> "SATURDAY", "SUNDAY") >> i

Re: [Tutor] Website form data input

2012-10-06 Thread Steven D'Aprano
On 07/10/12 09:16, Selby Rowley-Cannon wrote: Hello, I am aiming to write a program that inputs a list of codes into an HTML text field, one by one, entering the next code if it is incorrect, but stopping when the code is correct. I've got down putting the codes into a list, and 'for' loop

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Richard D. Moores
On Sat, Oct 6, 2012 at 4:35 PM, Alan Gauld wrote: > On 07/10/12 00:19, Richard D. Moores wrote: > >> That "1" means Tuesday, right? But how can I use calendar to print out >> that word, "TUESDAY"? > > > days = ("Monday", > "Tuesday", > "Wednesday", > "Thursday", > "

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Richard D. Moores
On Sat, Oct 6, 2012 at 4:29 PM, Dave Angel wrote: > To turn an integer (0-6, or whatever) into a string, just use a tuple of > the same size: > > tran = ("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", > "SATURDAY", "SUNDAY") > i = 1 > print tran[i] > > (prints "TUESDAY") Why did you cho

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Richard D. Moores
On Sat, Oct 6, 2012 at 4:42 PM, Mark Lawrence wrote: > Use calendar.day_name. How? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread eryksun
On Sat, Oct 6, 2012 at 7:19 PM, Richard D. Moores wrote: > > But now I'm thinking it would be handy to not only know that, say, 500 > days from today is 2014-02-18, but to know what day if the week that > is. >>> from datetime import date >>> date(2014, 2, 18).strftime("%A") 'Tuesday'

Re: [Tutor] website is returning error when I post data

2012-10-06 Thread eryksun
On Sat, Oct 6, 2012 at 3:00 PM, Benjamin Fishbein wrote: > > This program checks to see if a college buyback site is buying back > particular books. > > action="/BuyBack-Search.php?CSID=AQ2ZJKUWKZJBSD2T2DDMKMKB" > > When I go to the website(without using Python) and I paste the text (isbns) > into

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Mark Lawrence
On 07/10/2012 00:19, Richard D. Moores wrote: On Fri, Oct 5, 2012 at 7:15 AM, Walter Prins wrote: Does this hint help? import datetime mydate = datetime.date(2012,10,5) mydate = mydate + datetime.timedelta(days=30) print mydate 2012-11-04 Yes! Thanks to all for their rapid responses. But

Re: [Tutor] Website form data input

2012-10-06 Thread Alan Gauld
On 06/10/12 23:16, Selby Rowley-Cannon wrote: I am aiming to write a program that inputs a list of codes into an HTML text field, ...but I don't know how to enter text into a text field in a website. This is probably going to be much harder than you ever realized however You can use u

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Alan Gauld
On 07/10/12 00:19, Richard D. Moores wrote: That "1" means Tuesday, right? But how can I use calendar to print out that word, "TUESDAY"? days = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday") print '2014/2/18 is: '

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Dave Angel
On 10/06/2012 07:19 PM, Richard D. Moores wrote: > On Fri, Oct 5, 2012 at 7:15 AM, Walter Prins wrote: > >> Does this hint help? >> > import datetime > mydate = datetime.date(2012,10,5) > mydate = mydate + datetime.timedelta(days=30) > print mydate >> 2012-11-04 > Yes! Thanks to al

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-06 Thread Richard D. Moores
On Fri, Oct 5, 2012 at 7:15 AM, Walter Prins wrote: > Does this hint help? > import datetime mydate = datetime.date(2012,10,5) mydate = mydate + datetime.timedelta(days=30) print mydate > 2012-11-04 Yes! Thanks to all for their rapid responses. But now I'm thinking it would

[Tutor] Website form data input

2012-10-06 Thread Selby Rowley-Cannon
Hello,      I am aiming to write a program that inputs a list of codes into an HTML text field, one by one, entering the next code if it is incorrect, but stopping when the code is correct. I've got down putting the codes into a list, and 'for' looping though it (maybe 'while' the entered code

[Tutor] website is returning error when I post data

2012-10-06 Thread Benjamin Fishbein
Hello. This problem has got me stumped, and I've been trying to figure it out for more than a month. This program checks to see if a college buyback site is buying back particular books. I'm using mac OSX Here's the code. import urllib,urllib2 base_url="http://textbooks.com"; action="/BuyBack-Se