Data formats: XML, INI, TOML and pickle · 11 / 15 Exercise Medium

Write an INI file

Objective

With ConfigParser you can also generate INI files: you create sections, assign keys and save it with write.

Instructions

  • The first line has the number n of lines; each one is section key value (one word per field).
  • Create the sections that are needed (once) and save the result to config.ini. Then show Sections: k with the number of sections.
Input
3
server host localhost
server port 8080
user name ana
Output
Sections: 2

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise