Queer European MD passionate about IT
Browse Source

Append to `secrets` file instead of overwriting

Davte 4 years ago
parent
commit
24482aecbc
1 changed files with 2 additions and 2 deletions
  1. 2 2
      examples/a_simple_bot.py

+ 2 - 2
examples/a_simple_bot.py

@@ -166,9 +166,9 @@ def _main():
         simple_bot_token = input("Enter bot token:\t\t")
         with open(
             f'{path}/secrets.py',
-            'w'
+            'a'  # Append to file, create if it does not exist
         ) as secrets_file:
-            secrets_file.write(f'simple_bot_token = "{simple_bot_token}"')
+            secrets_file.write(f'simple_bot_token = "{simple_bot_token}"\n')
 
     # Set logging preferences
     log_formatter = logging.Formatter(