Python Forum
counting with dictionaries
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
counting with dictionaries
#4
(Sep-07-2018, 01:04 PM)ichabod801 Wrote: Also, if someone does give a file to process, nothing gets processed. Use the if/else just to get the file name, then do the processing after the if/else, not as part of the else clause. When you do print(f.read()), there is nothing left to read. So content=f.read() gets nothing. And item on line 17 needs to be items.

this helps, It really disturbed me. Thanks mate

(Sep-07-2018, 08:19 AM)buran Wrote: from line #5 I guess you want to use the second command line argument as the file to process. At the same time on line 7 the file name is hard coded and you always process firstfile.txt that is located in the current working directory.

I was really misusing the sys.argv
Reply


Messages In This Thread
counting with dictionaries - by gitiya - Sep-07-2018, 08:11 AM
RE: counting with dictionaries - by buran - Sep-07-2018, 08:19 AM
RE: counting with dictionaries - by ichabod801 - Sep-07-2018, 01:04 PM
RE: counting with dictionaries - by gitiya - Sep-07-2018, 01:25 PM

Forum Jump:

User Panel Messages

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