Python Forum
problem in using input command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem in using input command
#4
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.csv
It 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
akbarza likes this post
Reply


Messages In This Thread
problem in using input command - by akbarza - Oct-19-2023, 06:05 AM
RE: problem in using input command - by akbarza - Oct-19-2023, 12:17 PM
RE: problem in using input command - by deanhystad - Oct-19-2023, 01:45 PM
RE: problem in using input command - by snippsat - Oct-19-2023, 01:50 PM
RE: problem in using input command - by popejose - Oct-19-2023, 03:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with print command in super() akbarza 5 697 Feb-01-2024, 12:25 PM
Last Post: deanhystad
  problem in entering address of a file in input akbarza 0 702 Oct-18-2023, 08:16 AM
Last Post: akbarza
  Facing Problem while opening a file through command prompt vlearner 4 2,002 Jan-30-2022, 08:10 AM
Last Post: snippsat
  Problem with input after function luilong 10 4,243 Dec-04-2021, 12:16 AM
Last Post: luilong
  How to input & output parameters from command line argument shantanu97 1 2,626 Apr-13-2021, 02:12 PM
Last Post: Larz60+
  Problem restricting user input in my rock paper scissors game ashergreen 6 4,704 Mar-25-2021, 03:54 AM
Last Post: deanhystad
  single input infinite output problem Chase91 2 1,998 Sep-23-2020, 10:01 PM
Last Post: Chase91
  Problem with the input marios 4 2,120 May-03-2020, 01:01 PM
Last Post: marios
  Taking Multiple Command Line Argument Input bwdu 6 4,136 Mar-29-2020, 05:52 PM
Last Post: buran
  command line input (arg parse) and data exchange Simba 7 4,403 Dec-06-2019, 11:58 PM
Last Post: Simba

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020