Пример #1
0
def start():
    crawler = Crawler()
    crawler_results = crawler.crawl()
    for crawler_result in crawler_results:
        attribute_string = crawler_result.get('attribute_string')
        attribute_usd_price = crawler_result.get('attribute_usd_price')
        attribute = crawler_result.get('attribute')
        converter = Converter()
        print attribute,converter.convert(attribute_usd_price,attribute_string)
Пример #2
0
def user_menu(input_path, output_path):
    menu_choices = []
    for filename in os.listdir(input_path):
        extension = filename.split(".")[-1]
        if extension == "csv" or extension == "xls":
            menu_choices.append(filename)
    for pos,val in enumerate(menu_choices):
        print(f"[{pos}]: {val[0:-4]}")
    valid_input = False
    while valid_input == False:
        user_input = input("\nPlease select a number from the choices listed above, or Q to exit: \n")
        if user_input == "Q" or user_input == "q":
            sys.exit()
        if not user_input.isnumeric():
            print("That isnt even a number yah dingus!")
        elif int(user_input) < len(menu_choices):
            valid_input = True
    Converter.process(os.path.join(input_path,menu_choices[int(user_input)]),output_path)
    return user_menu(input_path,output_path)