Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个列标题Fee。在python中使用xlwt,我成功生成了所需的 excel。创建 Excel 文件时,此列始终为空白。
是否可以将费用列预先格式化为“货币”和“两位小数”,这样当我在下载后在 Excel 文件的费用列中手动写入时,23应该变为23.00 美元?
我让它像这样工作:
currency_style = xlwt.XFStyle()
currency_style.num_format_str = "[$$-409]#,##0.00;-[$$-409]#,##0.00"
sheet.write(row+2, col, val, style=currency_style)