打开和处理文件中的文本 [英] Opening and processing text in files

查看:81
本文介绍了打开和处理文件中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在计算文本文件中各种文本百分比时遇到问题。以下是我的代码。非常感谢任何帮助,谢谢。

I''m having problem calculating various percentages of text in a text file. Below are my codes. Will appreciate any help, thanks.

展开 | 选择 < span class =codeDivider> | Wrap | 行号

推荐答案

在您的第一行代码中:
pento = x / 100 * filename
x filename 未定义。
In your first line of code:
pento = x/100 * filename
x and filename are undefined.


将一个文件名(我假设是一个字符串)乘以一个数字也是没有意义的。
It also makes no sense to multiply a filename (which I assume is a string) by a number.


你好兔子,你是对的,我正试图繁殖一个字符串数字。我遇到的事情与转换到浮动首先b4乘法有关,但我想弄清楚如何进行这种转换。有什么想法?
Hi Rabbit, you are right, I''m trying to multiply a string by a number. I came across something that has to do with converting to a float first b4 multiplying, but i''m trying to figure out how to do this conversion. Any ideas?


这篇关于打开和处理文件中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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