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


Python Data.printData方法代码示例

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


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

示例1: Controller

# 需要导入模块: import Data [as 别名]
# 或者: from Data import printData [as 别名]
class Controller(cmd.Cmd):
    def __init__(self):
        cmd.Cmd.__init__(self)
        self.intro = 'Welcome to Siggy\'s Data Presentation Program - SDPP \n'
        self.prompt = '>'
        self.data = Data()

    def do_load_data(self, importString):
        """
Load data from the specified file and location: load_data ./data/data4.csv
Will ask for name of new table.
        """
        if not self.checkSingleParam(importString):
            return
        print('load_data')
        tableName = input("Input table name>")
        l = tableName.split()
        if len(l) != 1:
            print("Table name can't be blank and must not contain spaces.")
            return
        self.data.importData(importString, tableName)

    def do_save_project(self, saveString):
        """
Save project to the specified file and location: save_project myproject.dat
        """
        if not self.checkSingleParam(saveString):
            return
        print('save_project')
        self.data.saveProject(saveString)

    def do_load_project(self, loadString):
        """
Load project from the specified file and location: load_project myproject.dat
        """
        if not self.checkSingleParam(loadString):
            return
        print('load_project')
        self.data.loadProject(loadString)

    def do_show(self, tableName):
        """
Show the current loaded data tables: show
        """
        l = tableName.split()
        if len(l) < 2:
            print('show')
            self.data.printData(tableName)

    def do_make_piechart(self, line):
        """
Will create Pie Chart.
        """
        pieChartTemplate = PieChartCreator()
        if (pieChartTemplate.setupChart(self.data)):
            myChart = pieChartTemplate.returnChart()
            if (isinstance(myChart, PieChart)):
                myChart.drawChart()

    def do_make_barchart(self, line):
        """
Will create Pie Chart.
        """
        barChartTemplate = BarChartCreator()
        if (barChartTemplate.setupChart(self.data)):
            myChart = barChartTemplate.returnChart()
            if (isinstance(myChart, BarChart)):
                myChart.drawChart()

    def do_exit(self, line):
        'Exit the program'
        return True

    def checkSingleParam(self, string):
        l = string.split()
        if len(l) != 1:
            print("Invalid number of arguments")
            return False
        return True
开发者ID:SiggyPony,项目名称:SiggyAssignmentThree,代码行数:81,代码来源:Main.py


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