'adb'.startwith('a')提示错误:AttributeError: 'str' object has no attribute 'startwith'
但是写成:
str = 'adb'
str.startwith('a')
成功运行,返回True
十分不解。求解
你好,是你的函数名写错了
函数为startswith(),你的函数少了个s
试一下吧
str 没有startwith 函数 只有 startswith
| startswith(...)
| S.startswith(prefix[, start[, end]]) -> bool
|
| Return True if S starts with the specified prefix, False otherwise.
| With optional start, test S beginning at that position.
| With optional end, stop comparing S at that position.
| prefix can also be a tuple of strings to try.