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


Python Transaction.country方法代码示例

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


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

示例1: parsepayout

# 需要导入模块: from transaction import Transaction [as 别名]
# 或者: from transaction.Transaction import country [as 别名]
def parsepayout(csvfile):

    tadic = {}

    # Move the cursor to the first csv row
    emptyrows = 0
    while csvfile.readline().startswith("Order Number") == False and emptyrows < 10:
        emptyrows = emptyrows + 1

    if emptyrows == 10:
        print "Not a valid csv file:", csvfile.name
        return tadic

        # Loop the csv rows and add the transactions into a dictionary, where currency is the key
    for line in csvfile:
        row = line.replace("\n", "").split(",")
        ta = Transaction()
        ta.chargeddate = datetime.strptime(row[COL_SRC_CHARGEDDATE], dateformat)
        ta.orderno = row[COL_SRC_ORDERNO]
        ta.currency = row[COL_SRC_CURRENCY]
        ta.salesinclvat = float(row[COL_SRC_SALESINCLVAT])
        ta.salesexclvat = float(row[COL_SRC_SALESEXCLVAT])
        ta.balance = float(row[COL_SRC_BALANCE])
        if ta.currency == "EUR":
            ta.fxrate = 1.00
        else:
            ta.fxrate = float(row[COL_SRC_FXRATE])
        ta.vat = float(row[COL_SRC_VAT])
        ta.payoutdate = datetime.strptime(row[COL_SRC_PAYOUTDATE], dateformat)
        ta.country = row[COL_SRC_COUNTRY]

        if tadic.has_key(ta.currency):
            talist = tadic[ta.currency]
        else:
            talist = tadic[ta.currency] = []

        talist.append(ta)

    return tadic
开发者ID:Ninjaware,项目名称:payoutparser,代码行数:41,代码来源:payoutparser.py


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