My ConfigParser (Python)

Summary for myself Updated from time to time ** I just need to know myself, so the terms may be wrong in some places **

!! View

#command
    #Argument option description

When do you use ConfigParser?

When dealing with configuration files (ini files)

Module loading

import ConfigParser #Python2
import configparser #Python2

Frequent operation

Suppose there is such an ini file

[I]
name = taro
age = 40
#Read ini file
ini = Configparser.SafeConfigParser()
ini.read()
    #The path of the ini file to read as an argument

#Get element(Taking the acquisition of taro as an example)
#pattern 1
name = ini.get['I']['name']
#Pattern 2
name = ini.get('I','name')

Recommended Posts

My ConfigParser (Python)
My Numpy (Python)
My sys (python)
My pyproj (python)
My pandas (python)
My str (python)
My pyautogui (python)
My shutil (python)
My matplotlib (python)
My pyperclip (python)
My sklearn (python)
[My memo] python
My Webdriver (Python)
My arcpy (python)
My win32gui (Python)
My os (python)
My python environment memo
My Beautiful Soup (Python)
[My memo] python -v / python -V
Python Tips (my memo)
My python data analysis container
configparser
Python
Parameter setting by python configparser
My python data analytics environment
I made my own Python library
[Python] My stock price forecast [HFT]
My favorite boto3 (Python) API sample
Python My Number verification module released
kafka python
Python basics ⑤
python + lottery 6
Python Summary
Built-in python
Python technique
Studying python
Python 2.7 Countdown
Python memorandum
python tips
python function ①
Python basics
Python memo
ufo-> python (3)
install python
Python Singleton
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
atCoder 173 Python
[Python] function
Python installation
python tips
Installing Python 3.4.3.
Try python
Python iterative
Python algorithm
Python2 + word2vec
[Python] Variables
Python functions