如何用Python将天数转换成具体的日期字符串表示?
- 内容介绍
- 文章标签
- 相关推荐
本文共计221个文字,预计阅读时间需要1分钟。
pythondef read_date_from_excel_cell(cell_value): if isinstance(cell_value, str): date_str=cell_value.strip() if len(date_str)==10 and date_str[:4].isdigit() and date_str[5:7].isdigit() and date_str[8:].isdigit(): return date_str[:4], date_str[5:7], date_str[8:] return None
在利用python读取Excel的时候, 日期格式的单元格读取出来是数字,该数字表示1990年01月01日到该日期的天数。
本文共计221个文字,预计阅读时间需要1分钟。
pythondef read_date_from_excel_cell(cell_value): if isinstance(cell_value, str): date_str=cell_value.strip() if len(date_str)==10 and date_str[:4].isdigit() and date_str[5:7].isdigit() and date_str[8:].isdigit(): return date_str[:4], date_str[5:7], date_str[8:] return None
在利用python读取Excel的时候, 日期格式的单元格读取出来是数字,该数字表示1990年01月01日到该日期的天数。

