如何禁用Excel自动识别数字和文字 [英] How to disable Excel's auto recognition of numbers and text

查看:429
本文介绍了如何禁用Excel自动识别数字和文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Python来生成一个CSV文件。但是当我在Excel中打开它时,Excel会自动将一个字符串识别为一个数字,如果可以转换。



例如 33E105 成为 33 * 10 ^ 105 这实际上是一个ID,而不是一个数字。



如何在打开CSV文件时在Excel中禁用此功能?或者我需要使用excel-python库来输出一个excel文件,并自己指定格式?



我还发现了一个类似的问题没有很好的答案在网络上。



谢谢!

解决方案

写实际 .xls 在Python中的文件,而不是 .csv Excel可能会误解的文件,可以使用 xlwt 第三方Python包。


I used Python to generate a CSV file. But when I open it in Excel, Excel will auto recognize a string into a number if it could be converted.

e.g.33E105 becomes 33*10^105, which is actually an ID, not a number.

How to disable this in Excel while opening a CSV file? Or I need to resort to a excel-python library to output a excel file and specify the format myself?

I also found a similar question without good answers on the web.

Thanks!

解决方案

To write actual .xls files in Python, rather than .csv ones that Excel might misinterpret, you can use the xlwt third-party Python package.

这篇关于如何禁用Excel自动识别数字和文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆