hi
what should be the difference in output of write and writelines command for writting data in a file???
thnks
hi
what should be the difference in output of write and writelines command for writting data in a file???
thnks
I really don't think there's difference in output, just that using write() you can write a string, using writelines() you can write a list of strings.
For example:
Code:f=file("C:\\a.txt", "w") f.write("some text") f.close() #This will write the string "some text" in the file #Trying to write a sequence of strings like this will result in an errorCode:strings=["word1","some other word","bla"] f=file("C:\\a.txt", "w") f.write(strings) f.close()