本文整理汇总了Python中kivy.storage.jsonstore.JsonStore.count方法的典型用法代码示例。如果您正苦于以下问题:Python JsonStore.count方法的具体用法?Python JsonStore.count怎么用?Python JsonStore.count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.storage.jsonstore.JsonStore
的用法示例。
在下文中一共展示了JsonStore.count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addStory
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import count [as 别名]
class addStory(object):
'''
This class is used for adding story to the game
Syntax for the story is a key based dictionary, these keys are hexadacimal numbers
that will be used to track progress. Starting point is 1, so if scenario 1 had 3
possible options then there would be 11, 12, and 13. If 13 had 2 options then it would
be 131, and 132. This will continue until there is a string of 16 characters
basic syntax: {key
'''
def __init__(self):
self.File = raw_input("Which story would you like to edit?\n\n").lower()
self.data = JsonStore(self.File + '.json')
self.start = 1 #default start code
if self.data.count(): #If file has been started
print '\nLooking for where you left off...\n'
keys = self.data.keys()
leftOff = int(keys[len(keys) - 1])
print ('It seems like you left off at event number'
' %d, so let\'s move on to number %d.'
% (leftOff, leftOff + 1)
)
self.start = leftOff
self.addToDBLoop(self.start)
def addToDBLoop(self, number):
event = raw_input('What is event number %d?\n' % number).lower()
optionsStr = raw_input(('What are the available options for player?\n'
'If none just type \'none\'.\n')).lower().split()
c = 0
options = {}
for o in optionsStr:
c += 1
options[o] = str(number) + str(c)
self.data.put(str(number), event = event, options = options)
示例2: print
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import count [as 别名]
charIndustry = 'char/IndustryJobs.xml.aspx?keyID=%s&vCode=%s&characterID=%s'
# Defaults that will be replaced by the API returned data.
# ['Server Online', Players, Cache Expire]
# serverStatus = ['', '0', serverTime]
# Global variables to store the cacheUtil time and table rows.
jobsCachedUntil = serverTime
starbaseCachedUntil = serverTime
# This is where we are storing our API keys.
pilotRows = []
if pilotCache.count() > 0:
print('Character Data Already Exists: %s Entries' % (len(pilotCache)))
for key in pilotCache:
print(key) # Using characterID as key
print(pilotCache.get(key)['characterName'])
# keyID, vCode, characterID, characterName, corporationID, corporationName, keyType, keyExpires, skills, isActive
pilotRows.append(Character(pilotCache.get(key)['keyID'], pilotCache.get(key)['vCode'],
pilotCache.get(key)['characterID'], pilotCache.get(key)['characterName'],
pilotCache.get(key)['corporationID'], pilotCache.get(key)['corporationName'],
pilotCache.get(key)['keyType'], pilotCache.get(key)['keyExpires'],
pilotCache.get(key)['skills'], pilotCache.get(key)['isActive']))
else:
# No Pilot data.
print('No Pilot data.')