python - 如何在 Python 中修复这个特定的“TypeError:'str' object is not callable”错误?(初学者问题)
问题描述
似乎无法在此代码中找到错误。感谢我能得到的任何帮助。
x = input("Enter the price of AAPL stock today: ")
x = int(x)
y = input("Enter the number of APPLE stocks that you want to buy: ")
y = int(y)
print('The total funds required to buy {} shares of AAPL stock at {}
dollars is {}'.format(y, x, x*y))
解决方案
您在输出的字符串中缺少 {0}、{1} 和 {2}。
推荐阅读
- python - Git bash(Windows 10):如何在没有“python -m”的情况下调用python脚本开始输入行
- ajax - 来自 laravel 会话登录的经过身份验证的 api 调用。可能吗?
- javascript - 从节点列表 jquery 中删除节点
- git - Git - 远程修剪所有与 Dry Run 中的正则表达式匹配的分支
- r - 如何使用“lrm”模型(rms 包)对栅格堆栈进行空间预测?
- mysql - 1个主ID可以链接到一张表中的多个ID吗?
- websphere - Java 堆空间错误 | 在 Websphere 中部署 EAR 时出现内存不足
- sql - 使用 LISTAGG 后的正确语法
- javascript - 如何选择body标签而不是id?
- javascript - 如何在 Mapbox GL JS 中为 Geocoder 添加外部数据