Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's also wrong - "readlines" keeps the "\n", and you've added another one between lines.


Indeed. A cosmetic refinement, but it should really be:

  python -c "print ''.join(reversed(list(open('test.py'))))"
That's even two characters less!


Good, but too easy. Assume you can't keep the file in memory.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: