Exemplo n.º 1
0
def clear_output():
    """
    clear output for both jupyter notebook and the console
    """
    import os
    os.system('cls' if os.name == 'nt' else 'clear')
    if is_in_notebook():
        from IPython.display import clear_output as clear
        clear()
 def takeTicket(self):
     user_ticket = int(input(f"Take a number: {self.ticket_list}"))
     if user_ticket not in self.ticket_list:
         print('That ticket is taken. Please choose another ticket.')
     else:
         self.ticket_list.remove(user_ticket)
         self.current_ticket.update({user_ticket: 'NOT PAID'})
         clear()
         print(
             f"(This is your parking ticket. Please do not lose your ticket! {self.current_ticket})"
         )
 def parking_Options(self):
     options = input("What would you like to do? Pay/Park/Leave? ")
     if len(self.ticket_list) == 0 and options.lower() == "park":
         print('Sorry the parking lot is full. Please come back later.')
         return
     elif options.lower() == "park":
         self.takeTicket()
     elif options.lower() == "pay":
         self.pay_Ticket()
     elif options.lower() == "leave":
         self.leave_Garage()
     elif options.lower() not in ('pay', 'park', 'leave'):
         print("Invalid Choice")
         clear()
Exemplo n.º 4
0
def clear_output():
    def clear():
        return

    try:
        from IPython.display import clear_output as clear
    except ImportError as e:
        pass
    import os

    def cls():
        os.system('cls' if os.name == 'nt' else 'clear')

    clear()
    cls()
Exemplo n.º 5
0
def clear_output():
    """
    clear output for both jupyter notebook and the console
    """
    def clear():
        return
    try:
        from IPython.display import clear_output as clear
    except ImportError as e:
        pass

    import os

    def cls():
        os.system('cls' if os.name == 'nt' else 'clear')

    clear()
    cls()
Exemplo n.º 6
0
def clear_output():
    import os
    os.system('cls' if os.name == 'nt' else 'clear')
    if is_in_notebook():
        from IPython.display import clear_output as clear
        clear()
Exemplo n.º 7
0
def clearout():
    os.system('cls' if os.name == 'nt' else 'clear')
    if 'ipykernel' in sys.modules:
        from IPython.display import clear_output as clear
        clear()
Exemplo n.º 8
0
        print('list len:', len(politifact_list))
        print('=' * 3)

        file = open(file_path, 'w')
        json.dump(politifact_list, file, ensure_ascii=False)
        file.close()

        n += 1
        offset += limit
        if n % 5 == 0:
            timer0 = time.time() - t0
            timer1 = time.time() - t1
            t1 = time.time()

            os.system('clear')
            clear()  # Remove in script
            print('#' * 5, 'Scrape Politifact Script', '#' * 5)
            print('Round:', nr)
            print('Duplicates:', duplicate)
            print('Batch size:', limit)
            print('Round run time:', int(timer1 / 60), 'm',
                  round(timer1 % 60, 2), 's')
            print('Total run time:', int(timer0 / 60), 'm',
                  round(timer0 % 60, 2), 's')
            print('*' * 20)
            nr += 1

    except:
        print('#' * 5, 'STOPPED', '#' * 5)
        print(file_path)
        break