Q. Write the use and syntax for the following methods:

a) open()

b) read()

c) seek()

d) dump()


Answer :-

a = open( ) is use for excess file in read, write and append mode . Syntax :-

    <variable> = open( <file name> , <mode of open of file >)
   
    or
   
    with open ( <file name> , <mode of open of file > ) as <variable> :
 
b = read() function is use for reading the data of files . Syntax :-

    <file>.read( < number of character > )
   
c = seek( ) is use for change the position of pointer . Syntax :-
   
    <file object >. seek ( offset [,mode] )
   
d = dump() function is use for writing in binary file. Syntax :-
   
    pickle,dump( <object to be written > , < file handle>)

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post