DEV Community

DDSRY
DDSRY

Posted on • Updated on

What does 'w', 'r', and 'a' mean in Python Files Topic ?

Meaning of 'w', 'r', and 'a' in Python Programming Language Files Topic ?

▪ It's really just a string with a character in it for the kind of mode for the file.

▪ If you use 'w', then you are saying "open this file in 'write mode" - hence
the 'w' character.

▪ There's also 'r' for "read," 'a' for append, and modifiers on these.

Top comments (2)

Collapse
 
pgronkievitz profile image
Patryk Gronkiewicz

there're also w+, a+ and r+ to create file if not existent

Collapse
 
ddsry21 profile image
DDSRY

Yes, Correct.

Thank you for sharing this🙏