Advertisement
Guest User

mhh

a guest
Dec 9th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.10 KB | None | 0 0
  1. ------------COSA VOGLIO------------
  2.  
  3. {
  4.     "program": {
  5.         "firstExecute": "true"
  6.     },
  7.     "messages": {
  8.         "startMessage": "- Hello from PasswordRemainder.\n--> Digit '/start' to init\n--> Digit /exit to end the exectuion.",
  9.         "pinInsert": "Before start type a name and a pin. (Pin = only integers password)",
  10.         "exitMessage": "Have a good day ;D. Remaind the pin!!!"
  11.     }
  12. "user": {[
  13.     "name": nomeinserito,
  14. "pin": pininserito
  15. ]}
  16. }
  17.  
  18.  
  19. --------SCRIPT---------
  20.         with open(f'{self.dir}/settings.json') as settings:
  21.             jsonSettings = json.load(settings)
  22.             jsonSettings['program']['firstExecute'] = "false"
  23.             with open(f'{self.dir}/settings.json', 'a') as output:
  24.                 jsonSettings['user'] = []
  25.                 jsonSettings['user'].append({"name": name, "pin": pin})
  26.                 json.dump(jsonSettings, output, indent=2)
  27.  
  28.  
  29. ---------JSON---------
  30. {
  31.     "program": {
  32.         "firstExecute": "true"
  33.     },
  34.     "messages": {
  35.         "startMessage": "- Hello from PasswordRemainder.\n--> Digit '/start' to init\n--> Digit /exit to end the exectuion.",
  36.         "pinInsert": "Before start type a name and a pin. (Pin = only integers password)",
  37.         "exitMessage": "Have a good day ;D. Remaind the pin!!!"
  38.     }
  39. }
  40.  
  41. -------------RIUSLTATO-------------
  42.  
  43. {
  44.     "program": {
  45.         "firstExecute": "true"
  46.     },
  47.     "messages": {
  48.         "startMessage": "- Hello from PasswordRemainder.\n--> Digit '/start' to init\n--> Digit /exit to end the exectuion.",
  49.         "pinInsert": "Before start type a name and a pin. (Pin = only integers password)",
  50.         "exitMessage": "Have a good day ;D. Remaind the pin!!!"
  51.     }
  52. }{
  53.   "program": {
  54.     "firstExecute": "false"
  55.   },
  56.   "messages": {
  57.     "startMessage": "- Hello from PasswordRemainder.\n--> Digit '/start' to init\n--> Digit /exit to end the exectuion.",
  58.     "pinInsert": "Before start type a name and a pin. (Pin = only integers password)",
  59.     "exitMessage": "Have a good day ;D. Remaind the pin!!!"
  60.   },
  61.   "user": [
  62.     {
  63.       "name": "123",
  64.       "pin": 123
  65.     }
  66.   ]
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement