Python Forum
write in a distant file, code improvement with a list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
write in a distant file, code improvement with a list
#5
What are the contents of the text file before you read it? If that is the output of the print statement, there are no newline characters in the file, rendering the splitlines call useless (note that you can use f.readlines() instead).

I would note that 21, 30, and 33 don't really do anything, so you should be able to delete them. 21 and 30 are undone by 22 and 31, but note that you have different file specifications on those pairs of lines.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
code improvement - by lateublegende - Feb-19-2019, 04:02 PM
RE: write in a distant file, code improvement with a list - by ichabod801 - Feb-21-2019, 08:27 PM
RE: code improvement - by ichabod801 - Feb-19-2019, 07:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Any suggestions for improvement?(my first python code) PyAlex 9 6,181 Sep-08-2018, 06:45 PM
Last Post: PyAlex

Forum Jump:

User Panel Messages

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