函数str()无法正常工作,我不知道该怎么办 由 脆弱不堪发布于 2020-04-09 03:05:26 我有代码: def rides(x): return list(str(x)) 当我输入单词hi时不带引号 它返回未定义hi的错误 但是,当输入整数或带引号的hi时,它可以工作,但是我需要它在不带引号的hi中工作。
When your input is
hi
without quotes, it means you pass a variable namedhi
to your function. If you don't define such variable before passing it to your function, your code will fail during it's evaluation withNameError
error.