0% found this document useful (0 votes)
10 views13 pages

Binary Code

The document contains Python code for managing data using the pickle module, including functions for creating, reading, appending, searching, updating, and deleting records for various datasets such as sports, books, banks, staff, and trains. Each dataset is handled with specific functions that allow for user interaction to input and modify data. The code is structured but includes commented-out sections and some indentation issues that may affect execution.

Uploaded by

k.r.dhyan9894
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views13 pages

Binary Code

The document contains Python code for managing data using the pickle module, including functions for creating, reading, appending, searching, updating, and deleting records for various datasets such as sports, books, banks, staff, and trains. Each dataset is handled with specific functions that allow for user interaction to input and modify data. The code is structured but includes commented-out sections and some indentation issues that may affect execution.

Uploaded by

k.r.dhyan9894
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import pickle

#individual list

'''def create():

a=open("[Link]","wb")

b="yes"

while b=="yes":

c=input("enetr name:")

d=input("enter name of sport:")

e=int(input("enter no of medals secures"))

b=input("do you want to continue")

[Link]([c,d,e],a)

[Link]()

#create()

def read():

a=open("[Link]","rb")

try:

while True:

b=[Link](a)

print(b)

except EOFError:

[Link]()

read()

def append():

a=open("[Link]","ab")

b="yes"

while b=="yes":

c=eval(input("enter data:"))

b=input("do you want to append more:")

[Link](c,a)
[Link]()

#append()

def search():

a=open("[Link]","rb")

c=input("enter name:")

e="yes"

try:

while e=="yes":

b=[Link](a)

if b[1]==c:

print(b)

e=input("enter y/n:")

except EOFError:

[Link]()

#search()

def update():

a=open("[Link]","rb")

b=input("enter name:")

r=[]

try:

while True:

c=[Link](a)

if c[1]==b:

e=eval(input("enter new data:"))


[Link](e)

else:

[Link](c)

except EOFError:

[Link]()

f=open("[Link]","wb")

for i in r:

[Link](i,f)

[Link]()

#update()

def delete():

a=open("[Link]","rb")

b=input("enter name:")

r=[]

try:

while True:

c=[Link](a)

if c[1]==b:

pass

else:

[Link](c)

except EOFError:

[Link]()
f=open("[Link]","wb")

for i in r:

[Link](i)

[Link](i,f)

[Link]()

#delete()'''

'''#nested list

def create():

a=open("[Link]","wb")

b="yes"

d=[]

while b=="yes":

c=eval(input("enter book details:"))

[Link](c)

b=input("enter yes or no:")

[Link](d,a)

[Link]()

#create()

def read():

a=open("[Link]","rb")

try:

b=[Link](a)

print(b)

except EOFError:

[Link]()

read()

def search():
a=open("[Link]","rb")

try:

b=[Link](a)

c=input("enter book name:")

for i in b:

if i[0]==c:

print(i)

except EOFError:

[Link]()

#search()

def append():

a=open("[Link]","rb")

b=[Link](a)

c=eval(input("enter book details:"))

[Link](c)

[Link]()

d=open("[Link]","wb")

[Link](b,d)

[Link]()

#append()

def update():

a=open("[Link]","rb")

c=input("enter book name:")

r=[]

d=eval(input("enter book details:"))

b=[Link](a)

for i in b:

if i[0]==c:
[Link](d)

else:

[Link](i)

[Link]()

f=open("[Link]","wb")

[Link](r,f)

[Link]()

#update()

def delete():

a=open("[Link]","rb")

c=input("enter book name:")

b=[Link](a)

for i in b:

if i[0]==c:

[Link](i)

[Link]()

f=open("[Link]","wb")

[Link](b,f)

[Link]()

#delete()'''

'''#[Link]

def create():

a=open("[Link]","wb")

b="yes"

while b=="yes":
c=eval(input("enter bank details:"))

b=input("yes/no")

[Link](c,a)

[Link]()

#create()

def read():

a=open("[Link]","rb")

try:

while True:

b=[Link](a)

print(b)

except EOFError:

[Link]()

read()

def search():

a=open("[Link]","rb")

c=input("enter name:")

try:

while True:

b=[Link](a)

if b[0]==c:

print(b)

except EOFError:

[Link]()

#search()

def append():

a=open("[Link]","ab")

b="yes"
while b=="yes":

c=eval(input("enter data:"))

b=input("enter yes/no:")

[Link](c,a)

[Link]()

#append()

def update():

a=open("[Link]","rb")

b=[]

e=input("enetr name:")

c=eval(input("enter data:"))

try:

while True:

d=[Link](a)

if d[0]==e:

[Link](c)

else:

[Link](d)

except EOFError:

[Link]()

f=open("[Link]","wb")

for i in b:

[Link](i,f)

[Link]()

#update()'''

#individual dictionary
'''def create():

a=open("[Link]","wb")

b="yes"

while b=="yes":

staffdetails=eval(input("enter details:"))

[Link](staffdetails,a)

b=input("enter yes or no:")

[Link]()

#create()

def read():

a=open("[Link]","rb")

try:

while True:

b=[Link](a)

print(b)

except EOFError:

[Link]()

read()

def search():

a=open("[Link]","rb")

c=int(input("enter staff id:"))

try:

while True:

b=[Link](a)

for i in b:

if c in b:

print(b[c])
except EOFError:

[Link]()

#search()

def append():

a=open("[Link]","ab")

b="yes"

while b=="yes":

c=eval(input("enter data :"))

b=input("yes/no:")

[Link](c,a)

[Link]()

#append()

def update():

a=open("[Link]","rb")

c=int(input("enter staff id:"))

l=[]

try:

while True:

b=[Link](a)

if c in b:

d=int(input("enter salary:"))

b[c][1]=d

[Link](b)

except EOFError:

[Link]()

f=open("[Link]","wb")

for i in l:

[Link](i,f)
[Link]()

#update()

def delete():

a=open("[Link]","rb")

c=int(input("enter staff id:"))

l=[]

try:

while True:

b=[Link](a)

if c in b:

del b[c]

[Link](b)

except EOFError:

[Link]()

f=open("[Link]","wb")

for i in l:

[Link](i,f)

[Link]()

#delete()'''

#nested ditionary

def create():

a=open("[Link]","wb")

b="yes"

train={}

while b=="yes":

trainno=int(input("enter trian no:"))

trainname=input("enter name:")

traintime=int(input("enter train time:"))


traindistance=int(input("enter train distance:"))

train[trainno]={trainname:[traintime,traindistance]}

b=input("enter yes or no")

[Link](train,a)

[Link]()

#create()

def read():

a=open("[Link]","rb")

b=[Link](a)

print(b)

read()

def search():

a=open("[Link]","rb")

b=[Link](a)

c=int(input("enter train no:"))

if c in b:

print(b[c])

[Link]()

#search()

def append():

a=open("[Link]","rb")

b=[Link](a)

c=eval(input("enter train :"))

[Link](c)

d=open("[Link]","wb")

[Link](b,d)

[Link]()
#append()

def update():

a=open("[Link]","rb")

b=[Link](a)

c=int(input("enter train no:"))

f=[]

if c in b:

e=eval(input("enter data:"))

b[c]=e

[Link](b)

[Link]()

w=open("[Link]","wb")

[Link](f,w)

[Link]()

#update()

def delete():

a=open("[Link]","rb")

b=[Link](a)

c=int(input("enter train no:"))

f=[]

if c in b:

del b[c]

[Link](b)

[Link]()

w=open("[Link]","wb")

[Link](f,w)

[Link]()

#delete()

You might also like