Is file
a keyword in python?
I've seen some code using the keyword file
just fine, while others have suggested not to use it and my editor is color coding it as a keyword.
Is file
a keyword in python?
I've seen some code using the keyword file
just fine, while others have suggested not to use it and my editor is color coding it as a keyword.
No,
file
is a builtin, not a keyword:It can be seen as an alias for
open()
, but it has been removed from Python 3, as the newio
framework replaced it. Technically, it is the type of object returned by theopen()
function.