I need to convert date string "2013-1-25" to string "1/25/13" in python.
I looked at the datetime.strptime
but still can't find a way for this.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
If you can live with 01 for January instead of 1, then try...
You can check the docs for other formatting directives.
I assume I have
import datetime
before running each of the lines of code belowprints
"01/25/13"
.If you can't live with the leading zero, try this:
This prints
"1/25/13"
.EDIT: This may not work on every platform: