4 ms·
Is empty string acceptable in place of None? If so, consider partition: key, sep, value = item.partition("=") If you need to know whether there was a split/
by tech2 4y ago
Is empty string acceptable in place of None? If so, consider partition:
key, sep, value = item.partition("=")
If you need to know whether there was a split/match that occurred you could test sep's truthiness.