How do you open an already existing file and add content to it?
Answer / Mrs Arati Hyanki
To open an existing file in write mode (which creates the file if it doesn't exist) and append data to its end, use `open(filename, 'a')`. To write a string to the file, use the write() method. For example: `with open('myfile.txt', 'a') as f:nt f.write('New line of text.n')`.
| Is This Answer Correct ? | 0 Yes | 0 No |
How will you capitalize the first letter of a string?
Name some commonly used built-in modules in python?
How to walk through a list in a sorted order without sorting the actual list?
Is numpy faster than python?
How to make any variable private in python ?
What do you understand by the process of compilation and linking in python?
What’s the difference between a list and a dictionary?
Why is python good for machine learning?
What is python list function?
Why is not__getattr__invoked when attr==’__str__’?
What is slug in python?
What is __init__.py used for?