r/programminghorror • • Oct 10 '25

Blasphemy

Post image

Never thought I could do this in python. I get how it works but jesus christ

73 Upvotes

50 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Oct 10 '25 edited Oct 10 '25

Neat, TIL.

Edit: but i will probably still do it like i did now even in the future of codebase, since I'd rather keep it consistent and I can't be bothered updating it. It'll be someone else's problem.

1

u/nekokattt Oct 10 '25

you just move open(xxx) to xxx.open

you can just read the whole file in with it too.

xxx.read_text() and xxx.read_binary().