繁体   English   中英

Python - TypeError:“元组”对象不可调用

[英]Python - TypeError: 'tuple' object is not callable

当我编写这个程序时,它给了我这个错误。 为什么?

n = []
for x range(1500, 2701):
    if(x % 7 == 0) and (x % 5== 0):
        n.append(str(x))
print(",".join(n))

TypeError: 'tuple' object is not callable

尝试这个:

n = []
for x in range(1500, 2701):
    if x % 7 == 0 and x % 5 == 0:
        n.append(str(x))
print(",".join(n))
  • If 语句中不需要括号
  • 在 for..in 中缺少 in

暂无
暂无

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

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