akbarza Wrote:FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\akbar\\Desktop\\techcruch.csv'The problem is that you do not have file named
techcruch.csv
on Desktop.Python never lies👀 about this.
akbarza Wrote:I downloaded it on my desktop, so its address on my PC is: C:\Users\akbar\Desktop\techcruch.csvIt goes in
Downloads
folder if not specify or move the file to Desktop. So it work if i put file with that name on my desktop.
def csv_reader(file_name): for row in open(file_name, "r"): yield row def y(address): csv_gen = csv_reader(address) row_count = 0 for row in csv_gen: row_count += 1 print(f"Row count is {row_count}") address = r"C:\Users\tom\Desktop\techcruch.csv" y(address)
Output:Row count is 65