Python Forum
Read file, reformat and write new file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read file, reformat and write new file

I'm new to coding and struggling with a file that will take me an age to do manually.

I have a file C:\file.txt in format at the bottom. I would like to run a script that reads the file at bottom and outputs in this format to a new file.

Aaron View Residential Home30 beds, Contact, Owner: Mrs Karalia, Phone: 0114 286 9753, Email: [email protected], Website: \n
Abberton Manor Nursing Home26 beds, Contact, Owner: Mrs Hooper, Phone: 01206 735590, Email: [email protected], Website: \n

An excerpt of the original file C:\file.txt is here ....

Aaron View Residential Home30 beds
Owner: Mrs Karalia

Phone: 0114 286 9753
Email: [email protected]
Abberton Manor Nursing Home26 beds
Owner: Mrs Hooper

Phone: 01206 735590
Email: [email protected]
Abbey Court Nursing Home22 beds
Owner: Mr & Mrs Persand

Phone: 01474 854136
Email: [email protected]
Abbey Dale House Nursing Home26 beds
Owner: Mr Nadin

Phone: 01492 530955
Email: [email protected]

Many thanks
Please read:
We will be glad to help, but you must make an effort.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Read csv file through PyCharm kimx0961 3 120 Yesterday, 07:05 PM
Last Post: perfringo
  UART Serial Read & Write to MP3 Player Doesn't Work bill_z 15 557 Jul-17-2021, 04:19 PM
Last Post: bill_z
  Why it does not print( Rejaul84 1 246 Jul-01-2021, 10:37 PM
Last Post: bowlofred
  Read and write active Excel file euras 4 370 Jun-29-2021, 11:16 PM
Last Post: Pedroski55
  [Solved] Trying to read specific lines from a file Laplace12 7 522 Jun-21-2021, 11:15 AM
Last Post: Laplace12
  [Solved] Using readlines to read data file and sum columns Laplace12 4 313 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  How to save modification of a file in original file not a new one? mjrezayani 3 572 Jun-04-2021, 01:28 PM
Last Post: snippsat
  Subprocess.Popen() not working when reading file path from csv file herwin 13 1,146 May-07-2021, 03:26 PM
Last Post: herwin
  code for CSV file to html file without pandas jony057 1 461 Apr-24-2021, 09:41 PM
Last Post: snippsat
  Copy column from one existing excel file to another file mkujawsk 0 483 Apr-14-2021, 06:33 PM
Last Post: mkujawsk

Forum Jump:

User Panel Messages

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