简体   繁体   English

如何在python中打开ANS文件?

[英]How do i open ANS files in python?

Python 2.7.8 (with colorama) doesn't seem to load ANS files correctly. Python 2.7.8(带有colorama)似乎无法正确加载ANS文件。 When i print an ANS file out, the output is blank. 当我打印出ANS文件时,输出为空白。

The code is is: o = open("C:\\ANSI\\DATA\\MENU1.AMS", 'r') print(o) Am i forgetting a special character or something? 代码是: o = open("C:\\ANSI\\DATA\\MENU1.AMS", 'r') print(o)我是否忘记了特殊字符或其他内容?

Here you are not at all printing the contents of the file 在这里,您根本不打印文件内容

YOU can do it with the help of read() function. 您可以借助read()函数来做到这一点。

Doing it like print(o.read()) would work fine. print(o.read())可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM