DEV Community

Cover image for Mastering Python: 6 Sneaky Tips Every Developer Should Know

Mastering Python: 6 Sneaky Tips Every Developer Should Know

Jagroop Singh on March 03, 2024

Hey, Pythonistas! 🐍 Whether you're a seasoned developer or just starting out in the world of programming, Python has most likely grabbed your int...
Collapse
 
manhdt profile image
thitkhotau

To read/ write a file, I prefer using pathlibs with Path(file).read_text(...) without context managers rather than using with open("file.txt", "r"). I see it is shorter, OOP than, but I don't see other advantages.