Check sibling questions

How is method write() different from writelines() in python?

 

Answer:

write( )

writelines( )

This method writes a string into a file.

This method writes a sequence of strings to the file.

Syntax:

str=”hello”

f.write(str)

Syntax:

strlist=[“hello”,”world”]

f.writelines(strlist)

Introducing your new favourite teacher - Teachoo Black, at only ₹83 per month

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.