Professional Documents
Culture Documents
(a) ... in Python are interpreted as a sequence or stream of bytes stored on some storn
media.
(b) The..
(b) The. function creates a file object used to call other support methods associated witk
(c) Files in Python can be opened in one of the three modes.
and....
(d) The.. method writes a
..
list of strings to a file.
(e) The . . . . method of a file object flushes any unwritten information and closes the file obje=
(f) The name of the current working directory can be determined
using ... method. . .
(i) A... . file is a series of 1's and 0's, treated as raw data and read byte-by-byte.
he.statement automatically closes the file afterthe processing on the file gets over.
(k) The read() function reads data from the . . . of a file.
two main methods called.***ossose. dna....
()The pickle module produces for writing a
reading operations. and
from the file t i l l . .
(m) The readlines() returns a list of lines
the file.
(n) The. method reads 'n' characters from
from buffer to file.
(o) functionis used to force transfer of data
(p) . format is a text format accessible to all applications across several nla
method is used for random access of data in a CSV file. tforms.
() . method of pickle module is used to write an object into binary file.
(S) . method of pickle module is used to read data from a binary file.
(t) . statement is given for importing csV module into your program.
(u) . i s a string method that joins the string with a string separator.
(v)****s********
.object contains the number ofthe current line in a CSV file.
(w) To read all the file contents in the form of a list, . method is used.
(x) To write contents of list, tuple and sequence data type,
. method may be used
(v) To force Python to write the contents of file buffer on to storage file,
used.
*******.****
method maybe
(z) When we work with file, .
open it.
ssesses*.. .. area is automatically associated with the file
when we
2. State whether the following statements are True
or False.
(a) An absolute path always begins with the root
folder.
(b) It is not necessary to always create the
file in the same default
installed. folder where Python has been
(c) In
binary file, there is no delimiter for a
line.
(d) A binary file stores
information in ASCll or Unicode
(e) readline() reads the entire file characters.
at a time.
(6) A closel) function breaks the
link of the file
e) When you open a file in read object and the file on the disk.
FileNotFound error. mode, the given file must
exist in the folder;
otherwise Python wi
(h) The default file
open mode is write mode.
) Opening a file in
append mode erases the
0) A file mode defines
the type of previous data.
(k) stream is defined as
A operations that is to be
() readlines() function
a
sequence of characters. performed on the frile.
returns a list of
(m) Data maintained
inside
strings, each separated by "\n".
the file is
(n)with statement termed as
ensures that all the "persistent" (permanent in nature) a.
(o)
automatically. resources allocated to the file
aae get deallocat
i filel =
open (file =
"C:\ test.txt", "r")
tiv filel =
open (file =
"c:\\s test.txt", "r")
lTo open a file c:\ test.txt for writing, we should use the statement:
) f o b j = open ("c: \ t e s t . t x t " , "w")
(c) To open a file c:\ test.txt for appending data, we can give the statement:
() fobj = open ( " c : \ \ t e s t . t x t " , "a")