import pickle
def addressbookwrite(path='C:\\addressbook.txt'):
start=0
book={"test":"test rabotaet"}
f = open(path, 'ab')
while True:
name = input('Vvedite imya abonenta\n')
if name=="stop":
pickle.dump(book, f)
f.close()
ask()
telnum=input('Vvedite nomer\n')
book[name]=telnum
pickle.dump(book,f)
f.close()
def loadbook(path='C:\\addressbook.txt'):
while True:
f = open(path, "rb")
name=input("Kogo naiti?\n")
if name == "stop":
f.close()
ask()
book=pickle.load(f)
try:
print(book[name])
except:
print("Imya ne naideno")
f.close()
def ask():
ans=input("1:Dobavit' abonenta\n2:Naiti abonenta\n3:Vihod\n")
if ans=='1':
addressbookwrite()
elif ans=='2':
loadbook()
else:
print('Vihod')
ask()
aW1wb3J0IHBpY2tsZQpkZWYgYWRkcmVzc2Jvb2t3cml0ZShwYXRoPSdDOlxcYWRkcmVzc2Jvb2sudHh0Jyk6CiAgICBzdGFydD0wCiAgICBib29rPXsidGVzdCI6InRlc3QgcmFib3RhZXQifQogICAgZiA9IG9wZW4ocGF0aCwgJ2FiJykKICAgIHdoaWxlIFRydWU6CgogICAgICAgIG5hbWUgPSBpbnB1dCgnVnZlZGl0ZSBpbXlhIGFib25lbnRhXG4nKQogICAgICAgIGlmIG5hbWU9PSJzdG9wIjoKICAgICAgICAgICAgcGlja2xlLmR1bXAoYm9vaywgZikKICAgICAgICAgICAgZi5jbG9zZSgpCiAgICAgICAgICAgIGFzaygpCiAgICAgICAgdGVsbnVtPWlucHV0KCdWdmVkaXRlIG5vbWVyXG4nKQogICAgICAgIGJvb2tbbmFtZV09dGVsbnVtCiAgICBwaWNrbGUuZHVtcChib29rLGYpCiAgICBmLmNsb3NlKCkKZGVmIGxvYWRib29rKHBhdGg9J0M6XFxhZGRyZXNzYm9vay50eHQnKToKCiAgICB3aGlsZSBUcnVlOgogICAgICAgIGYgPSBvcGVuKHBhdGgsICJyYiIpCiAgICAgICAgbmFtZT1pbnB1dCgiS29nbyBuYWl0aT9cbiIpCiAgICAgICAgaWYgbmFtZSA9PSAic3RvcCI6CiAgICAgICAgICAgIGYuY2xvc2UoKQogICAgICAgICAgICBhc2soKQogICAgICAgIGJvb2s9cGlja2xlLmxvYWQoZikKICAgICAgICB0cnk6CiAgICAgICAgICAgIHByaW50KGJvb2tbbmFtZV0pCiAgICAgICAgZXhjZXB0OgoKICAgICAgICAgICAgcHJpbnQoIklteWEgbmUgbmFpZGVubyIpCiAgICAgICAgZi5jbG9zZSgpCgpkZWYgYXNrKCk6CiAgICBhbnM9aW5wdXQoIjE6RG9iYXZpdCcgYWJvbmVudGFcbjI6TmFpdGkgYWJvbmVudGFcbjM6Vmlob2RcbiIpCiAgICBpZiBhbnM9PScxJzoKICAgICAgICBhZGRyZXNzYm9va3dyaXRlKCkKICAgIGVsaWYgYW5zPT0nMic6CiAgICAgICAgbG9hZGJvb2soKQogICAgZWxzZToKICAgICAgICBwcmludCgnVmlob2QnKQphc2soKQoKCg==
Main.java:1: error: '.' expected
import pickle
^
Main.java:2: error: ';' expected
def addressbookwrite(path='C:\\addressbook.txt'):
^
Main.java:2: error: unclosed character literal
def addressbookwrite(path='C:\\addressbook.txt'):
^
Main.java:2: error: illegal character: '\'
def addressbookwrite(path='C:\\addressbook.txt'):
^
Main.java:2: error: illegal character: '\'
def addressbookwrite(path='C:\\addressbook.txt'):
^
Main.java:2: error: unclosed character literal
def addressbookwrite(path='C:\\addressbook.txt'):
^
Main.java:5: error: unclosed character literal
f = open(path, 'ab')
^
Main.java:5: error: unclosed character literal
f = open(path, 'ab')
^
Main.java:8: error: unclosed character literal
name = input('Vvedite imya abonenta\n')
^
Main.java:8: error: illegal character: '\'
name = input('Vvedite imya abonenta\n')
^
Main.java:8: error: unclosed character literal
name = input('Vvedite imya abonenta\n')
^
Main.java:13: error: unclosed character literal
telnum=input('Vvedite nomer\n')
^
Main.java:13: error: illegal character: '\'
telnum=input('Vvedite nomer\n')
^
Main.java:13: error: unclosed character literal
telnum=input('Vvedite nomer\n')
^
Main.java:17: error: unclosed character literal
def loadbook(path='C:\\addressbook.txt'):
^
Main.java:17: error: illegal character: '\'
def loadbook(path='C:\\addressbook.txt'):
^
Main.java:17: error: illegal character: '\'
def loadbook(path='C:\\addressbook.txt'):
^
Main.java:17: error: unclosed character literal
def loadbook(path='C:\\addressbook.txt'):
^
Main.java:40: error: unclosed character literal
print('Vihod')
^
Main.java:40: error: unclosed character literal
print('Vihod')
^
20 errors