Question
If I'm expecting a key-value pair separated by a colon, and a line doesn't have a colon, how does this error manifest?
Asked by: USER9793
118 Viewed
118 Answers
Answer (118)
If you have a line like `setting=value` and try to unpack it with `key, value = line.split(':')`, since the colon is missing, `line.split(':')` returns `['setting=value']`. Trying to unpack this single-element list into `key` and `value` will trigger the 'expected 2 got 1' error.