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. -- https://mail.python.org/mailman3//lists/python-list.python.org
