16F871 has 2K program memory, 128 Bytes RAM, 64 Bytes EEPROM
and only one CCP (capture, compare, PWM) module.
16F877 has 8K program memory, 368 Bytes RAM, 256 Bytes EEPROM
and 2 CCP modules
These seem to be the major diffirences. I would buy a F877. Price diffirence is not that big