Two novel donor–acceptor conjugated polymers with 5H-dithieno[3,2-b:2',3'-d]pyran as a strong electron-donating unit and diketopyrrolopyrrole as electron accepting units were synthesized. The photophysical and electrochemical properties were investigated and compared. With the same donor unit, 3,6-di(thien-2-yl)pyrrolopyrroledione-based polymer showed an almost linear spatial structure, while 3,6-di(furan-2-yl)pyrrolopyrroledione-based polymer exhibited a V-shaped structure. The power conversion efficiency of solar cells based on 3,6-di(thien-2-yl)pyrrolopyrroledione-based polymer, with a high carrier mobility benefiting from almost linear backbone of 3,6-di(thien-2-yl)pyrrolopyrroledione-based polymer, was much higher than that of photovoltaic cells based on 3,6-di(furan-2-yl)pyrrolopyrroledione-based polymer. This work demonstrated a good example for enhancing efficiency of diketopyrrolopyrrole-based solar cells by adjusting the spatial structure.