In python-3.X dict.values doesn't return a list like how it performs in python-2.X. In python-3.x it returns a dict-value object which is a set-like object and uses a hash table for storing its items. This feature, in addition to supporting most of set attributes, is very optimized for some operations like membership checking (using in operator). And because of that, it doesn't support indexing.

If you want to get a list object, you need to convert it to list by passing the result to the list() function.

the_values = dict.values()
SUM = sum(list(the_values)[1:10])

python列表和字典之间的相互转换_loner_fang的博客-CSDN博客_ ...

https://blog.csdn.net/loner_fang/article/details/80940600

2018年7月6日 ... 注:字典可以直接使用list转换成列表。 dit = {'name':'zxf',.

Python : How to convert a list to dictionary ? – thispointer.com

https://thispointer.com/python-how-to-convert-a-list-to-dictionary/

Jun 30, 2018 ... In this article we will discuss different ways to convert a single or multiple lists to dictionary in Python. Following conversions from list to ...

python 列表,元组,字典,集合,字符串相互转换- 知乎

https://zhuanlan.zhihu.com/p/82703713

2019年9月16日 ... 将列表转化为元组li = [1, 2, 3] t = tuple(li) print(t, type(t)) # 打印结果:(1, 2, 3) <class ' tuple'> # 将元组转换成列表tu = (1, 2, 3) li = list(tu) print(li, ...

Python -- 字典转换为列表_5后's Blog-CSDN博客_字典转换为列表

https://blog.csdn.net/wudj810818/article/details/50353019

2015年12月18日 ... 说明:列表不可以转换字典. ①转换后的列表为无序列表. a = {'a' : 1, 'b': 2, 'c' : 3}. #字典中的key转换为列表. key_value = list(a.keys()).

How to convert a dictionary to a numpy array in Python

https://www.kite.com/python/answers/how-to-convert-a-dictionary-to-a-numpy-array-in-python

Use numpy.array() to convert a dictionary to an array. Call dict.items() to return a collection of the key-value pairs in dict . Use ...

python如何将dict转成list - SegmentFault 思否

https://segmentfault.com/q/1010000010362346

python如何将dict转成list. Yannan_CR. 27. 发布于2017-07-26. 我有很多个dict, 例如{A:A1,B:B2,C:C3,D:D4},{A:AA1,C:CC3,D:DD4,E:EE5},{A:AAA1,B:BBB2 ...

python3 字典、列表、数组和字符串之间的相互转化_zhangyu4863的 ...

https://blog.csdn.net/zhangyu4863/article/details/80575064

2018年6月5日 ... ... 词 清除标记. python字典转数组_python 数组变成字典的方法 ... python中如何 将字典直接变成二维数组_Python中将字典转换为列表的方法.

Python: how to convert a dictionary into a subscriptable array ...

https://stackoverflow.com/questions/33674033/python-how-to-convert-a-dictionary-into-a-subscriptable-array

In python-3.X dict.values doesn't return a list like how it performs in python-2.X. In python-3.x it returns a dict-value object which is a set-like ...

Converting Dictionary to List? - Stack Overflow

https://stackoverflow.com/questions/1679384/converting-dictionary-to-list

I'm trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict['Capital']="London" ...

Python Convert List to Dictionary: A Complete Guide: A Complete ...

https://careerkarma.com/blog/python-convert-list-to-dictionary/

Jan 14, 2021 ... You can convert a Python list to a dictionary using the dict.fromkeys() method, a dictionary comprehension, or the zip() method. The zip() method ...

csv文件与字典,列表等之间的转换小结【Python】 - SegmentFault ...

https://segmentfault.com/a/1190000007092479

2016年10月7日 ... 本文针对前面利用Python 所做的一次数据匹配实验,整理了其中的一些对于csv 文件的读写操作和常用的Python'数据结构'(如字典和列表)之间的 ...

How to convert Python dictionary object to numpy array - Stack ...

https://stackoverflow.com/questions/7471872/how-to-convert-python-dictionary-object-to-numpy-array

The following will do it: arr = np.array([(k,)+v for k,v in data_dict.iteritems()], \ dtype =[('date', '|O4'), ('high', '<f8'), ('low', '<f8')]). If you then wish to ...

Convert a list to a dictionary in Python - Stack Overflow

https://stackoverflow.com/questions/4576115/convert-a-list-to-a-dictionary-in-python

b = dict(zip(a[::2], a[1::2])). If a is large, you will probably want to do something like the following, which doesn't make any temporary lists like the ...

Python | Convert a list to dictionary - GeeksforGeeks

https://www.geeksforgeeks.org/python-convert-a-list-to-dictionary/

Sep 25, 2020 ... To convert a list to dictionary, we can use list comprehension and make a key: value pair of consecutive elements. Finally, typecase the list to dict ...

How to convert Python Dictionary to a list?

https://www.tutorialspoint.com/How-to-convert-Python-Dictionary-to-a-list

Feb 22, 2018 ... Python's dictionary class has three methods for this purpose. The methods items (), keys() and values() return view objects comprising of tuple of ...

Convert JSON to dictionary in Python - GeeksforGeeks

https://www.geeksforgeeks.org/convert-json-to-dictionary-in-python/

Dec 29, 2020 ... Return type: It returns the python dictionary object. Example 1: Let's suppose the JSON file looks like this: python-json. We want to convert the ...

JSON encoding and decoding with Python - Python Tutorial

https://pythonspot.com/json-encoding-and-decoding-with-python/

May 3, 2015 ... The json module enables you to convert between JSON and Python ... To convert JSON to a Python dict use this: ... data = json.loads(array)

Python | Convert dictionary to list of tuples - GeeksforGeeks

https://www.geeksforgeeks.org/python-convert-dictionary-to-list-of-tuples/

Feb 18, 2019 ... Given a dictionary, write a Python program to convert the given dictionary into list of tuples. Examples: Input: { 'Geeks': 10, 'for': 12, 'Geek': 31 } ...