本文整理汇总了Python中utils.Utils.renameFile方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.renameFile方法的具体用法?Python Utils.renameFile怎么用?Python Utils.renameFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Utils
的用法示例。
在下文中一共展示了Utils.renameFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parseFile
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import renameFile [as 别名]
def parseFile(self):
print 'Parsing product file...'
productsRegular = []
productsPromo = []
# open products file and process items
with open(Utils.getConfig()['productFile']) as json_file:
json_data = json.load(json_file)
for item in json_data:
product = {}
# not available products are omitted
# if item['avail'] == self.PROD_NOT_AVAIL:
# continue
product['id'] = long(item['id'])
product['price'] = float(item['price'])
product['category'] = item['cat']
# product['name'] = data['name'].encode('utf-8')
product['url'] = item['url'].encode('utf-8')
# in case of regular product add it to separate table
if item.get('oldPr', None) is None:
product['date'] = self.dateTime[:10]
productsRegular.append(product)
else:
product['old_price'] = item['oldPr']
product['discount'] = item['disc']
# product['description'] = data['descr'].encode('utf-8')
product['url'] = item['url'].encode('utf-8')
productsPromo.append(product)
self.updateRegularProducts(productsRegular)
self.updatePromoProducts(productsPromo)
Utils.renameFile(Utils.getConfig()['productFile'])
示例2: parseFile
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import renameFile [as 别名]
def parseFile(self):
print "Parsing product file..."
productsRegular = []
productsPromo = []
# open products file and process items
with open(Utils.getConfig()["productFile"]) as json_file:
json_data = json.load(json_file)
for item in json_data:
product = {}
# not available products are omitted
# if item['avail'] == self.PROD_NOT_AVAIL:
# continue
try:
product["id"] = long(item["id"])
product["price"] = float(item["price"])
product["category"] = item["cat"]
# product['name'] = data['name'].encode('utf-8')
product["url"] = item["url"].encode("utf-8")
# in case of regular product add it to separate table
if item.get("oldPr", None) is None:
product["date"] = self.dateTime[:10]
productsRegular.append(product)
else:
product["old_price"] = item["oldPr"]
product["discount"] = item["disc"]
# product['description'] = data['descr'].encode('utf-8')
product["url"] = item["url"].encode("utf-8")
productsPromo.append(product)
except:
pass
self.updateRegularProducts(productsRegular)
self.updatePromoProducts(productsPromo)
Utils.renameFile(Utils.getConfig()["productFile"])
示例3: finish
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import renameFile [as 别名]
def finish(self):
print("Więcej informacji: https://github.com/thof/decapromolist#decapromolist" + self.SPACES, file=self.mdFile)
print(
"PayPal: [email protected]_ (w razie gdyby ktoś chciał wspomóc projekt)" + self.SPACES,
file=self.mdFile,
)
self.mdFile.close()
Utils.renameFile(Utils.getConfig()["decapromolistFile"])
Utils.saveJsonFile(Utils.getConfig()["decapromolistFile"], self.products)
示例4: saveSubcategories
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import renameFile [as 别名]
def saveSubcategories(self, dataCat):
Utils.renameFile(Utils.getConfig()["subcatFile"])
Utils.saveJsonFile(Utils.getConfig()["subcatFile"], dataCat)
示例5: __init__
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import renameFile [as 别名]
def __init__(self):
self.products = []
Utils.renameFile(Utils.getConfig()["decapromolistMDFile"])
self.mdFile = open(Utils.getConfig()["decapromolistMDFile"], "w")
with open(Utils.getConfig()["subcatFile"]) as jsonFile:
self.subcatData = json.load(jsonFile)