Fredrik Lundh wrote:
Hi,
I've tried calendar.month_ name[0], it displays empty string, while
calendar.month_ name[1] is "January"? Why does calendar.month_ name's
index not start with index 0 as calendar.day_na me?
Thanks,
Sophon
Henry Chang wrote:
>
>
if you have a datetime or date object, you can use strftime with the
appropriate formatting code. see the library reference for details.
>
if you have the weekday number, you can use the calender module:
>
'Monday'
>
(the latter also contains abbreviated day names, month names, and a
bunch of other potentially useful functions and mappings.)
>
</F>
>
--
>
>
>Instead of getting integers with weekday(), Monday == 0 ... Sunday ==
>6; is there a way to get the actual names, such as "Monday ...
>Sunday"? I would like to do this without creating a data mapping. :)
>6; is there a way to get the actual names, such as "Monday ...
>Sunday"? I would like to do this without creating a data mapping. :)
if you have a datetime or date object, you can use strftime with the
appropriate formatting code. see the library reference for details.
>
if you have the weekday number, you can use the calender module:
>
>import calendar
>calendar.day_n ame[0]
>calendar.day_n ame[0]
>
(the latter also contains abbreviated day names, month names, and a
bunch of other potentially useful functions and mappings.)
>
</F>
>
--
>
I've tried calendar.month_ name[0], it displays empty string, while
calendar.month_ name[1] is "January"? Why does calendar.month_ name's
index not start with index 0 as calendar.day_na me?
Thanks,
Sophon
Comment