Python data engineering interview problem. Difficulty: intermediate. Pattern: Strings. About 15 minutes. Part of the Pro drill bank.
A nightly mainframe extract is fixed-width, not CSV. Each field lives in character positions defined by a spec. You must slice, not split on commas.
Parse fixed-width lines using the provided field spec.
Input: parse_fixed_width(['SKU1widget'], [('sku', 0, 4), ('name', 4, 6)]) Output: [{'sku': 'SKU1', 'name': 'widget'}] This input follows the stated rules and produces this output.
Topics: lakebench, python, file/data-processing.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Parse a list of fixed-width text lines into structured records using column offsets.
Parse fixed-width lines using the provided field spec.