Originally Posted by druuna
filename is the variable that holds a value and .txt is a hardcoded extension. The braces make sure that filename recognized as such.
In the two contexts shown, the braces are not wrong but are not necessary because the following "." is not a valid variable name character so terminates the variable name.