On 10/06/2012 09:10 PM, Richard D. Moores wrote: > On Sat, Oct 6, 2012 at 4:29 PM, Dave Angel <d...@davea.name> 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 choose "tran"? > > Dick > >
tran was short for "translation table." It's also the name of a keyword I implemented in an interpreter over 35 years ago. Of course, Mark has pointed out that equivalent functionality is already in the calendar module i = 1 print calendar.day_name[i] day_name isn't a list or tuple, but it behaves enough like one for this purpose. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor