Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. import os
  2. import time
  3. import random
  4. from colorama import init
  5. from colorama import Fore, Back, Style
  6. from colors import red, green, blue, white, black, yellow
  7. init()
  8. db_list_file = open("db_list.pbd", 'r') #Open file
  9. db_list_read = db_list_file.read() #Read the file
  10. already_db = db_list_read
  11. def error_missing_arguments():
  12.     print(red('ERROR: Missing arguments. Use command "help" for more info.',style="bold"))
  13. print("Psssssssssssss")
  14. while True:
  15.     command_input = input(green(">PrBYDA: ",style="bold"))
  16.     if command_input=="create":
  17.         error_missing_arguments()
  18.     elif command_input=="create db":
  19.         db_name = input("Enter the database name: ")
  20.         if already_db==db_name:
  21.             print("ALREADY DB!!!!!")
  22.         print(yellow("Already DBS: "+already_db))
  23.         print(green("DB Name: "+db_name))
  24.         if not ".db" in db_name:
  25.             print(red('ERROR: The database name needs to have .db extension.',style="bold"))
  26.         else:
  27.             print("Creating database...")
  28.             database_file_created = db_name #Get file name
  29.             database = open(database_file_created, 'w')
  30.             database.close()
  31.             print("Database created.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement