TypeError:一元+的操作数类型错误:'str'当我认为代码正确时

2024-07-04 16:00:30 发布

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

character_age = "13"
character_name = "lado"
print(   + character_name +    " really like coding")
print( " but she didnt learn to type until "  + character_age +  " years old. ")

当出现这些错误时,我正试图用python学习变量

PS D:\freecodecamp> & C:/Users/admin/AppData/Local/Programs/Python/Python39/python.exe d:/freecodecamp/2.py
Traceback (most recent call last):
  File "d:\freecodecamp\2.py", line 6, in <module>
    print(+_character_name+   " really like coding, ")
TypeError: bad operand type for unary +: 'str'

Tags: namepyagetypelearnlikebutprint

热门问题