假设我有一个包含一堆字符串的字典:
d = {'seq1':'AGG', 'seq2':'GCCG', 'seq3':'', 'seq4':'TTAAA'}
获得所有值长度之和的最佳方法是什么?在这个例子中,总长度是 3 + 4 + 0 + 5,所以我希望输出是 12。
是否可以在不使用循环的情况下做到这一点?
python dictionary string-length python-3.x
dictionary ×1
python ×1
python-3.x ×1
string-length ×1