Created
April 8, 2019 03:49
-
-
Save leisurelicht/e830c8225ca722ab4bbb23c9255ec699 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*-coding: utf-8-*- | |
import datetime | |
import xlwt | |
workbook = xlwt.Workbook() | |
worksheet = workbook.add_sheet('My Sheet') | |
# style = xlwt.XFStyle() | |
style = xlwt.easyxf(num_format_str='YYYY/MM/DD HH:MM') | |
style.num_format_str = 'M/D/YY' | |
# Other options: D-MMM-YY, D-MMM, MMM-YY, h:mm, h:mm:ss, h:mm, h:mm:ss, M/D/YY h:mm, mm:ss, [h]:mm:ss, mm:ss.0 | |
worksheet.write(0, 0, datetime.datetime.now(), style) | |
workbook.save('Excel_Workbook.xls') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment