0

I have a python script that reads a csv file and converts it to two new files so that my database can add new emails or update existing ones. What im trying to do now is after it has converted them for it to send me a email with how many rows it processed for both the add adn update file. I have the email part workign what has me stuck is the counting of the rows which for somereason everything i have tried returns me actual values from the files and not a number like im wanting to to. could someone please help me figure this out.

2
Contributors
4
Replies
51
Views
4 Years
Discussion Span
Last Post by abaddon2031
0

I have tried that but when i attempt to add the results of it to the email message i get cannot concatenate a str and int objects. How do i get it to allow the results in the message

1

Add str(cnt).

By the way, this is better:

with open("foo.csv") as f: cnt = sum(1 for line in f)

because the file is properly closed.

Edited by Gribouillis

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.