<p>我正在构建一个python脚本,用于在上传到internet时查找文件的ETA。我在python上做的很粗糙。
基本上程序要求你输入文件大小和上传速度。
但我卡住了!!</p>
<p>剧本是这样的:。。(进行中)</p>
<pre><code>print "UPLOADING TIME COVERTER"
print
print " Please enter the file size in mb"
size = raw_input()
# for e.g 237mb
print
print "Please enter the current uploading speed in kb /sec"
speed = raw_input()
# for e.g 60kb/sec
print
A = speed * 60
# speed is changed into minutes
B = (A / 1024)
#KB is changed in MB
C = (B / size)
print "your eta is %r hours" %(C)`
</code></pre>
<p>我收到的错误是:</p>
<pre><code>Traceback (most recent call last):
File "uploadingeta.py", line 14, in <module>
B = (A - 1024)
TypeError: unsupported operand type(s) for -: 'str' and 'int'.
</code></pre>
<p>我到处搜索谷歌,但都找不到解决办法。</p>