Reading values from an INI file

Files with the extension .ini are the legacy of the old Windows versions (16 bit). In the past, they were extensively used—and still are to some extent—ubiquitously to store the settings for applications. Nowadays, it is common practice to store settings in the registry. Though textual, such files have a very well-defined structure; there are sections and key-value pairs. A section starts with a label enclosed in square brackets: [section-name] and a key-value is implemented as <variable name>=<value>. Such a structure could be useful, for instance, if we wanted to keep the settings organized by environments or by user profiles within an.ini file.

Note

In this recipe, you will also see an example of how to use the ...

Get Advanced UFT 12 for Test Engineers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.