<div dir="ltr"><div style="font-size:12.8000001907349px">Hello everybody. I'm writing a CLI program to do some search. It's an internal tool. I'd like to provide the option to my user to format the results as he/she'd like. Something similar to strftime on the datetime module.</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Example:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">    from datetime import datetime</div><div style="font-size:12.8000001907349px">    d = datetime.utcnow()</div><div style="font-size:12.8000001907349px">    d.strftime("%Y-%m-%d")  # '2015-04-18'</div><div style="font-size:12.8000001907349px">    d.strftime("%y-%m-%d")  # '15-04-18'</div><div style="font-size:12.8000001907349px">    d.strftime("Today it's the %dth day in the %mth month of %Y") # '<span style="font-size:12.8000001907349px">Today it's the 18th day in the 04th month of 2015</span>' # Don't pay attention to ordinals, just simple example.<br clear="all"><div><br></div><div>Now, an example of with my application. Suppose my app search cars:</div><div><br></div><div>    python search_cars.py -F "Brand %B, model %m, year %Y"  # Brand Ford, model Focus, year 1996</div><div>    python <span style="font-size:12.8000001907349px">search_cars</span>.py -F "%B - %m (%y)"  # Ford - Focus (96)<br></div><div><br></div><div>I'd provide my user with a table like:</div><div>%B = Brand</div><div>%m = Model</div><div>%Y = Year format YYYY</div><div>%y = <span style="font-size:12.8000001907349px">Year format</span> YY</div><div>%s = Seller name</div><div>... etc...</div><div><br></div><div>Thanks a lot for your help!</div></div><div><br></div>-- <br><div class="gmail_signature">Santiago Basulto.-</div>
</div>