On 2026-06-13, Jon Ribbens <[email protected]> wrote: > On 2026-06-13, Paul Rubin <[email protected]> wrote: >> Jon Ribbens <[email protected]> writes: >>> with open('/proc/meminfo') as meminfo: >>> info = { >>> entry[0][:-1]: int(entry[1]) >>> for line in meminfo >>> if (entry := line.split()) >>> } >> >> with open('/proc/meminfo') as meminfo: >> info = dict(line.split()[:2] for line in meminfo) > > An excellent point, although it does mean the ':' characters remain > in the dictionary keys.
Oh, and doesn't have ints as the dictionary values, which is rather more fatal to the use-case. -- https://mail.python.org/mailman3//lists/python-list.python.org
