BEGINNER: converting integer to short month name?

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Apr 10 11:07:25 EDT 2003


MCollins at co.seminole.fl.us wrote in news:mailman.1049919678.686.python-
list at python.org:

> that works fine for the numerical month names.  now i'm trying to convert
> the numerical month into it's short month name equivalent to grab those
> files.
> 
> i could always use a long if , elif, elif to do the job, but i was
> wondering if there was built-in function already capable of that.  i was
> just looking for something a little more elegant.

Don't you just use the %b format string in strftime for this, or am I 
missing some subtlety in the question?

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list