1
我可以用它来确定序列中最长的字符串是什么,但我怎样才能找到最长字符串的索引。新的python顺便说一句,去我的请求容易。查找最长字符串的索引并返回该索引?
def longest_string(seq):
max_list = max(seq,key=len)
return max_list
print(longest_string(["h","el","lo","worl","d"]))
worl
谢谢你的帮助。 – Victor