Convert Python> two value sequence to dictionary

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 1515 / 12833)

You can use the dict() function to convert two-value sequences into a dictionary.

I made a sample based on the code of the book.

http://ideone.com/HMftGs

lol = [ [ 'pi', '3.1415'], ['napier', '2.71828'], ['avogadro', '6.022 x 10^23'] ]
print(lol)
 
mydict = dict(lol)
print(mydict['avogadro'])

result


[['pi', '3.1415'], ['napier', '2.71828'], ['avogadro', '6.022 x 10^23']]
6.022 x 10^23

Will it be used for file conversion?

Recommended Posts

Convert Python> two value sequence to dictionary
[python] Convert date to string
Convert numpy int64 to python int
[Python] Convert list to Pandas [Pandas]
Convert Scratch project to Python
[Python] Convert Shift_JIS to UTF-8
Convert python 3.x code to python 2.x
Python> dictionary> get ()> optional value
How to convert an array to a dictionary with Python [Application]
Convert markdown to PDF in Python
Replace dictionary value with Python> update ()
Workflow to convert formula (image) to python
Convert list to DataFrame with python
Python> list> Convert double list to single list
[Python] Convert natural numbers to ordinal numbers
Convert decimal numbers to n-ary numbers [python]
Python> tuple> Convert double tuple to single tuple
Python dictionary
[Python] dictionary
Python dictionary
[Python] How to convert db file to csv
Convert memo at once with Python 2to3
[Django] Convert QuerySet to dictionary type list
[Python] How to convert a 2D list to a 1D list
How to convert Python to an exe file
[Python] Convert csv file delimiters to tab delimiters
Convert psd file to png in Python
Convert Excel data to JSON with python
Convert Hiragana to Romaji with Python (Beta)
Convert from katakana to vowel kana [python]
Convert FX 1-minute data to 5-minute data with Python
python> Convert tuple to list> aList = list (pi_tuple)
[Introduction to Udemy Python3 + Application] 24. Dictionary type
Convert Python date types to RFC822 format
Convert HEIC files to PNG files with Python
Convert Chinese numerals to Arabic numerals with Python
Convert from Markdown to HTML in Python
[Introduction to Udemy Python3 + Application] 61. Dictionary comprehension
Convert absolute URLs to relative URLs in Python
Sample to convert image to Wavelet with Python
[Python] Memo dictionary
Python code to convert region mesh code to latitude / longitude
Updated to Python 2.7.9
[Introduction to Udemy Python 3 + Application] 26. Copy of dictionary
Convert FBX files to ASCII <-> BINARY in Python
[Python] How to use two types of type ()
Convert to HSV
Convert PDFs to images in bulk with Python
Python script to convert latitude / longitude to mesh code
[Python] Convert from DICOM to PNG or CSV
Convert svg file to png / ico with Python
[Python] Dictionary (hash)
Python basics: dictionary
Convert Windows epoch values to date with python
How to convert SVG to PDF and PNG [Python]
Python Note: When assigning a value to a string
How to get dictionary type elements of Python 2.7
Convert STL to Voxel mesh using Python VTK
Convert exponential notation float to str in Python
[Python Tips] How to retrieve multiple keys with the maximum value from the dictionary
String to Unicode Escape Sequence Format for Python