Writing multiple lines into a file in Python
Writing Multiple lines into the file in python :
We can use Python triple quotes """ """ to write multiple lines into a file. Instead of using more than one write functions.
Here is one small Example :
1 2 3 4 5 6 7 8 9 10 |
data = """Channel: SIP/10000 MaxRetries: 1 RetryTime: 60 WaitTime: 30 Context: test Extension: 100 """ with open('/root/test_file.call','w') as file: file.write(data) |