错误:主循环只能将元组(而不是“str”)连接到tup

2024-06-14 05:47:47 发布

您现在位置:Python中文网/ 问答频道 /正文

基本上是想修改这个教程的货币,而不是 股票:http://pythonprogramming.net/advanced-matplotlib-graphing-charting-tutorial/

我现在的代码是:

Error: main loop can only concatenate tuple (not "str") to tuple

代码:

^{pr2}$

Tags: 代码httpnetmatplotlibmain货币教程error
2条回答

您正在将CurrencysToPull元组传递给函数:

for eachStock in CurrencysToPull:
    pullData(CurrencysToPull)

然后尝试将字符串连接到:

^{pr2}$

您可能想传入eachStock而不是:

for eachStock in CurrencysToPull:
    pullData(eachStock)

错误在这一行: fileline = Currency+'.txt' 货币是元组,.txt是字符串

在for循环中,传递的是currencyStoull而不是eachStock。 它应该是:

for eachStock in CurrencysToPull:

在异常处理中使用回溯可以获得关于错误的更好信息。在

^{pr2}$

相关问题 更多 >