fork(1) download
  1. import pickle
  2. def addressbookwrite(path='C:\\addressbook.txt'):
  3. start=0
  4. book={"test":"test rabotaet"}
  5. f = open(path, 'ab')
  6. while True:
  7.  
  8. name = input('Vvedite imya abonenta\n')
  9. if name=="stop":
  10. pickle.dump(book, f)
  11. f.close()
  12. ask()
  13. telnum=input('Vvedite nomer\n')
  14. book[name]=telnum
  15. pickle.dump(book,f)
  16. f.close()
  17. def loadbook(path='C:\\addressbook.txt'):
  18.  
  19. while True:
  20. f = open(path, "rb")
  21. name=input("Kogo naiti?\n")
  22. if name == "stop":
  23. f.close()
  24. ask()
  25. book=pickle.load(f)
  26. try:
  27. print(book[name])
  28. except:
  29.  
  30. print("Imya ne naideno")
  31. f.close()
  32.  
  33. def ask():
  34. ans=input("1:Dobavit' abonenta\n2:Naiti abonenta\n3:Vihod\n")
  35. if ans=='1':
  36. addressbookwrite()
  37. elif ans=='2':
  38. loadbook()
  39. else:
  40. print('Vihod')
  41. ask()
  42.  
  43.  
  44.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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
stdout
Standard output is empty