Python Forum
Need Help with Simple Text Reformatting Problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need Help with Simple Text Reformatting Problem
#2
Where you have:
        if "<LINE>" in line:
            line = line.split("<LINE>")
            line = "".join(str(x) for x in line)
            _line = re.sub(r"</LINE>", " ", line)
            f.write(_line)
You have not taken out the end of line characters.
I have not created all the little files you have but try this:
        if "<LINE>" in line:
            line = line.split("<LINE>")
            line = "".join(str(x) for x in line)
            _line = re.sub(r"</LINE>", " ", line)
            outline = _line.rstrip('\r\n')
            _line = outline
            f.write(_line)
I just created the one file with all of your text in it so it might need some adjustment.
Reply


Messages In This Thread
RE: Need Help with Simple Text Reformatting Problem - by Barrowman - Aug-14-2017, 08:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple flask rest api problem cancerboi 4 2,914 Jan-29-2020, 03:10 PM
Last Post: brighteningeyes
  Help on parsing simple text on HTML amaumox 5 3,591 Jan-03-2020, 05:50 PM
Last Post: amaumox
  html to text problem Kyle 4 5,708 Apr-27-2018, 09:02 PM
Last Post: snippsat
  Problem With Simple Multiprocessing Script digitalmatic7 11 9,428 Apr-16-2018, 07:18 PM
Last Post: digitalmatic7
  Problem formatting output text aj347 5 4,244 Sep-10-2017, 04:54 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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