本文整理汇总了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