首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用ofxparse在ofx文件中更改FITID?

如何使用ofxparse在ofx文件中更改FITID?
EN

Stack Overflow用户
提问于 2019-04-01 14:02:09
回答 1查看 242关注 0票数 0

调试代码时,会发生更改,但打开文件时,没有任何更改。

代码语言:javascript
复制
from ofxparse import OfxParser
from datetime import datetime as dt

# opening ofx file
with open('/home/jovani/Downloads/ofx.ofx') as file:
    # Parser
    ofx = OfxParser.parse(file)
    #finding transactions
    transactions = ofx.account.statement.transactions
    now = dt.now() # I'll use this id like
    for fitid in transactions: #performing changes and it happens
        fitid_before = fitid.id
        fitid_after = now.strftime("%Y%m%d%f")
        fitid = fitid_after

之后,ofx.ofx文件中没有任何更改。

EN

回答 1

Stack Overflow用户

发布于 2019-06-15 10:47:49

您是在问为什么文件没有更改。

  1. 你打开文件是为了只读。这是默认的"with open“。
  2. 您没有试图向文件中写入任何内容。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55457015

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档