Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assignment_4 #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Introduction-to-Data-Science/Week-4/ShivaniP/assignment_4
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
1.ab+ mode opens a file for appending and reading in binary format.The file pointer is at the end of the file.

2.While reading the file, the data in the file is transfered in an intermediate buffer before it is accessed by
python.This buffer signifies the size of the buffer used.

3.
try:
a=1/0 #ZeroDivisionError
fh=open("python.txt",r)
fh.readline() #IOError
b=12
if(b>0)
print("greater than zero") #IndentationError
if(c>b)
print("c greater than b") #NameError
except IOError:
print("file not found!!!")
except ZeroDivisionError:
print("division by zero!!")
except NameError:
print("identifier not found!!!")

4.
file=open("file.txt",r+)
list=[]
file.seek(0,2)
pos=file.tell()
k=0
file.seek(0,0)
while k!=pos:
list.append(file.readline())
k=file.tell()
file.close()
for i in range(len(list),0,-1):
print(list[i])