Hello Mr. Tutor:
I constructed a pieced of code utilizing requests and pyodbc to download
creditcard statement transactions and insert them into a DB table based on the
code published by Louis Millette here:
https://github.com/louismillette/Banking/tree/master.
Now I am a total newbie to Python even though I had some experience writing in
other languages. The code works like a charm until where it comes to inserting
the transactions into the table. As you can see in my code, in order to avoid
duplicates being inserted into the table I’m trying to compared the downloaded
statement line to each existing line in the table through nested loop and
insert only when there’s no match. I kind of intuitively expect that there is
another much simpler way to compare each downloaded line to all the inserted
lines and find out if it is already in there. Obviously the approach I’m using
doesn’t really work as I want it to. Can you please give me some hints as to
how to get the loops to work as I explained or, if there is another better way
to do it, what would that look like?
Thanks a lot for your guidance.
Kaun
KUAN LU, CPA, CGA | FINANCE TEAM LEAD
________________________________
Email: [email protected] |
Tel.:416-757-7008,212 | Fax.:416-757-9656
67 Alexdon Rd. Unit 1, North York, M3J 2B5
[cid:[email protected]] <http://www.talize.com>
[cid:[email protected]]
<http://www.linkedin.com/company/talize/>
[cid:[email protected]]
<http://www.instagram.com/talizethrift/>
[cid:[email protected]] <http://www.facebook.com/TalizeThrift>
[cid:[email protected]]
<https://plus.google.com/+TalizeThriftStoreTalizeThriftStore>
[cid:[email protected]] <https://twitter.com/TalizeThrift>
The information transmitted, including attachments, is intended only for the
person(s) or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or other
use of, or taking of any action in reliance upon this information by persons or
entities other than the intended recipient is prohibited. If you received this
in error please contact the sender and destroy any copies of this information.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor