Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help me!!!
#2
Quote:Sorry guys in the above python code I forgot to indent. I corrected that mistake:-

Use Python code tags for proper code formatting (help page link).

Most probable cause for this is that each line of the text in your file ends with endline character, which is '\n'.
To find out simply add a print statement in your loop to see each "word" read from the file.
If that is the problem, solution is to use the rstrip('\'), rstrip being the string method.
Reply


Messages In This Thread
Please help me!!! - by yuganthafdo - May-04-2018, 06:00 PM
RE: Please help me!!! - by j.crater - May-04-2018, 06:23 PM
RE: Please help me!!! - by yuganthafdo - May-12-2018, 03:39 PM
RE: Please help me!!! - by j.crater - May-12-2018, 04:39 PM

Forum Jump:

User Panel Messages

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