L12 FileInputOutput
L12 FileInputOutput
and Practise an
h ug
u t
M
a n
L12 - File Input and Output n a th
a
Ram
• Open a file h y
a t
ap
• Read / Write data to it an
h ug
u t
• Close the file a n
M
th
n a
a
Ram
• f.seek(offset, reference) h y
a t
ap
• ‘reference’ can take 0 (beginning of a file),ga1n (current position) and 2 (end of
file) h u
u t
M
a n
• f.seek(12, 0) - moves to 12th position
n a t h from bof.
a
a m
• R
f.seek(-15, 2) - moves 15 positions to the left from eof.
• f.seek(0, 2)
• Format is the most common import and exporthyformat for spreadsheets and
databases a t
ap
an
name1,name2, name3 h ug
u t
ram1,ram2, ram3 M
a n
th
cam1,cam2, cam3 n a
a
Ram