1) What function is used to open a file in Python? a) open('fruit.txt', 'r+') b) open('fruit.txt', 'a+') c) open('frut.txt', 'a') d) none of the above 2) What is the best approach to guarantee that a file object is correctly closed after use whenever possible? a) Using close() at the end of the code b) Using try and finally blocks c) Using the with keyword d) None of the above 3) What function is used to get a list of all lines in a file? a) read() b) readlines() c) write() d) None of the above 4) Which of the following file types can be opened with notepad as well as ms excel? a) Binary Files b) Text Files c) CSV Files d) none of the above 5) . To open a file c:\scores.txt for writing, we use ____________ a) outfile = open(“c:\scores.txt”, “w”) b) outfile = open(“c:\\scores.txt”, “w”) c) outfile = open(file = “c:\scores.txt”, “w”) d) outfile = open(file = “c:\\scores.txt”, “w”)

szerző:

Ranglista

Vizuális stílus

Beállítások

Kapcsoló sablon

Automatikus mentés visszaállítása :?