【问题标题】:TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'类型错误:** 或 pow() 不支持的操作数类型:'str' 和 'int'
【发布时间】:2018-02-05 06:30:32
【问题描述】:
mixed = [1, 4, 'd']
if type(i) == int:
    for i in mixed:
        print([i ** 2])

【问题讨论】:

  • 你忘了问问题。

标签: python typeerror


【解决方案1】:

我猜你想做的是:

mixed = [1,4,'d']

for i in mixed:
    if type(i) == int:
        print([i ** 2])

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-25
    • 1970-01-01
    • 1970-01-01
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多