I am new to python and fstring, Can you please help me how to write multiple lines to the file with fstring, it is to create a config file with all the contents within the fstring is to be written to a file, ignoring the content what it has
    def create_testfile(self) -> None:
        """writes the config file 
       """
    value = f""" #==================================
## NAT network DHCP params configuration
bridge=$(ifconfig | grep  "flags" | awk -F : '{print $1}' | sed '/lo/d' | sed '/vif/d')
echo "${command}"
case "${command}" in
    online)
...
...
...
        port_num_check
esac
"""
    with open("network.txt", "w") as network:
        network.write(value)
Gives an error message File "", line 1 (print $1) ^ SyntaxError: invalid syntax
I tried changing the triple quoted string to single quoted string but there is another problem with that, adding \n will result in error message. SyntaxError: f-string expression part cannot include a backslash
 
     
    