当前位置: 首页>>代码示例>>Python>>正文


Python SourceFileLoader.get_table_from_file方法代码示例

本文整理汇总了Python中importlib.machinery.SourceFileLoader.get_table_from_file方法的典型用法代码示例。如果您正苦于以下问题:Python SourceFileLoader.get_table_from_file方法的具体用法?Python SourceFileLoader.get_table_from_file怎么用?Python SourceFileLoader.get_table_from_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在importlib.machinery.SourceFileLoader的用法示例。


在下文中一共展示了SourceFileLoader.get_table_from_file方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: number

# 需要导入模块: from importlib.machinery import SourceFileLoader [as 别名]
# 或者: from importlib.machinery.SourceFileLoader import get_table_from_file [as 别名]
# durability: number (year)


# importing everything you need
import os
from importlib.machinery import SourceFileLoader
current_file_path = os.path.dirname(os.path.abspath(__file__))
# User interface module
ui = SourceFileLoader("ui", current_file_path + "/../ui.py").load_module()
# data manager module
data_manager = SourceFileLoader("data_manager", current_file_path + "/../data_manager.py").load_module()
# common module
common = SourceFileLoader("common", current_file_path + "/../common.py").load_module()


table = data_manager.get_table_from_file("tool_manager/tools.csv")


# start this manager by a menu
def start():

    while True:
        ui.print_menu(title="Options", list_options=["Show-table", "Add", "Remove", "Update", "get available tools", "get average durability by manufacturers"], exit_message="Quit")
        user = ui.get_inputs(list_titles=["Please choose a number: "], title="")[0]
        if user == "0":
            break
        elif user == "1":
            show_table("tool_manager/tools.csv")
        elif user == "2":
            add(table)
        elif user == "3":
开发者ID:CodecoolBP20161,项目名称:python-lightweight-erp-3rd-tw-p6,代码行数:33,代码来源:tool_manager.py

示例2: number

# 需要导入模块: from importlib.machinery import SourceFileLoader [as 别名]
# 或者: from importlib.machinery.SourceFileLoader import get_table_from_file [as 别名]
# price: number (dollar)
# in_stock: number


# importing everything you need
import os
from importlib.machinery import SourceFileLoader
current_file_path = os.path.dirname(os.path.abspath(__file__))
# User interface module
ui = SourceFileLoader("ui", current_file_path + "/../ui.py").load_module()
# data manager module
data_manager = SourceFileLoader("data_manager", current_file_path + "/../data_manager.py").load_module()
# common manager module
common = SourceFileLoader("common", current_file_path + "/../common.py").load_module()

table = data_manager.get_table_from_file("store/games.csv")


# start this manager by a menu
def start():
    list_options = ["Show table",
                    "Add",
                    "Remove",
                    "Update",
                    "Get count by manufacturers",
                    "Get average by manufacturer"]
    ui.print_menu("Store menu", list_options, "Exit menu")
    inputs = ui.get_inputs(["Please enter a number: "], "")
    option = inputs[0]
    if option == '1':
        show_table(table)
开发者ID:CodecoolBP20161,项目名称:python-lightweight-erp-3rd-tw-p6,代码行数:33,代码来源:store.py

示例3: SourceFileLoader

# 需要导入模块: from importlib.machinery import SourceFileLoader [as 别名]
# 或者: from importlib.machinery.SourceFileLoader import get_table_from_file [as 别名]

# importing everything you need
import os
from importlib.machinery import SourceFileLoader
current_file_path = os.path.dirname(os.path.abspath(__file__))
# User interface module
ui = SourceFileLoader("ui", current_file_path + "/../ui.py").load_module()
# data manager module
data_manager = SourceFileLoader("data_manager", current_file_path + "/../data_manager.py").load_module()
# common module
common = SourceFileLoader("common", current_file_path + "/../common.py").load_module()
file_name = "crm/customers.csv"
menu_status = 0
# load table from file
table = data_manager.get_table_from_file(file_name)
# list of menu options
menu_options = ["Show customers",
                "Add customer to the table",
                "Remove customer from the table",
                "Update an item in the table",
                "Get the id of customer with the longest name in the table",
                "Get the name of the customer with the most subscription"]
list_labels = ["id", "name", "email", "subscribed"]
update_labels = ["name", "email", "subscribed"]
id_list = ["id"]

# start this module by a module menu like the main menu
# user need to go back to the main menu from here
# we need to reach the default and the special functions of this module from the module menu
#
开发者ID:Swaggerino,项目名称:python-lightweight-erp-3rd-tw,代码行数:32,代码来源:crm.py

示例4: handle_menu

# 需要导入模块: from importlib.machinery import SourceFileLoader [as 别名]
# 或者: from importlib.machinery.SourceFileLoader import get_table_from_file [as 别名]
# start this module by a module menu like the main menu
# user need to go back to the main menu from here
# we need to reach the default and the special functions of this module from the module menu
#

def handle_menu():
    options = ["Show table",
               "Add",
               "Remove",
               "Update",
               "Which year max",
               "Avg amount"]

    ui.print_menu("Menu", options, "Back to main menu")

table = data_manager.get_table_from_file("accounting/items.csv")
list_labels = ["nr1", "nr2", "nr3", "fd", "ffd"]


def start_module():
    handle_menu()
    back_to_main = 0
    while not back_to_main:
        inputs = ui.get_inputs(["Please:"], "")
        option = inputs[0]
        if option == "1":
            show_table(table)
        elif option == "2":
            add(table)
        elif option == "3":
            remove(table, id_)
开发者ID:Swaggerino,项目名称:python-lightweight-erp-3rd-tw,代码行数:33,代码来源:accounting.py

示例5: boolean

# 需要导入模块: from importlib.machinery import SourceFileLoader [as 别名]
# 或者: from importlib.machinery.SourceFileLoader import get_table_from_file [as 别名]
# email: string
# subscribed: boolean (Is she/he subscribed to the newsletter? 1/0 = yes/not)


# importing everything you need
import os
from importlib.machinery import SourceFileLoader
current_file_path = os.path.dirname(os.path.abspath(__file__))
# User interface module
ui = SourceFileLoader("ui", current_file_path + "/../ui.py").load_module()
# data manager module
data_manager = SourceFileLoader("data_manager", current_file_path + "/../data_manager.py").load_module()
# common module
common = SourceFileLoader("common", current_file_path + "/../common.py").load_module()

table = data_manager.get_table_from_file(current_file_path + "/customers.csv")


# print the default table of records from the file
#
# @table: list of lists
def show_table(table):
    title_list = ["ID", "name", "e-mail", "subscribed"]
    ui.print_table(table, title_list)
    pass


# Ask a new record as an input from the user than add it to @table, than return @table
#
# @table: list of lists
def add(table):
开发者ID:makaimark,项目名称:python-lightweight-erp-3rd-tw,代码行数:33,代码来源:crm.py


注:本文中的importlib.machinery.SourceFileLoader.get_table_from_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。