Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How do you open an already existing file and add content to it?



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

Post New Answer

More Python Interview Questions

How will you capitalize the first letter of a string?

1 Answers  


Name some commonly used built-in modules in python?

1 Answers  


How to walk through a list in a sorted order without sorting the actual list?

1 Answers  


Is numpy faster than python?

1 Answers  


How to make any variable private in python ?

1 Answers  


What do you understand by the process of compilation and linking in python?

1 Answers  


What’s the difference between a list and a dictionary?

1 Answers  


Why is python good for machine learning?

1 Answers  


What is python list function?

1 Answers  


Why is not__getattr__invoked when attr==’__str__’?

1 Answers  


What is slug in python?

1 Answers  


What is __init__.py used for?

1 Answers  


Categories