求助大佬pyehon中class的用法
大佬,我想问一下这个代码哪里有问题class Solution:
def romanToInt(self, s: str) -> int:
代码
def longestCommonPrefix(self, strs: list) -> str:
代码
报错:
Traceback (most recent call last):
File "C:\Users\mate\AppData\Roaming\JetBrains\PyCharmCE2021.2\scratches\second.py", line 1, in <module>
class Solution:
File "C:\Users\mate\AppData\Roaming\JetBrains\PyCharmCE2021.2\scratches\second.py", line 28, in Solution
def longestCommonPrefix(self, strs: list) -> str:
TypeError: 'type' object is not subscriptable def longestCommonPrefix(self, strs: list) -> str;
把 str 换下,可能是命名冲突了
页:
[1]