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
  Error When Trying To Read CSV File kaega2 3 131 Dec-03-2021, 09:10 PM
Last Post: kaega2
Photo how I write the output into xml file in python? 3lnyn0 1 264 Oct-31-2021, 05:40 PM
Last Post: Gribouillis
  Create a 2-channel numpy file from two cvs file containing a 9x9 matrix silvialecc 1 310 Oct-26-2021, 07:59 AM
Last Post: Gribouillis
  |SOLVED] Glob JPGs, read EXIF, update file timestamp? Winfried 5 442 Oct-21-2021, 03:29 AM
Last Post: buran
  Convert legacy print file to XLSX file davidm 1 326 Oct-17-2021, 05:08 AM
Last Post: davidm
  [SOLVED] Read text file from some point till EOF? Winfried 1 273 Oct-10-2021, 10:29 PM
Last Post: Winfried
  rows from sql query need to write to a file as columns sjcsvatt 6 417 Oct-09-2021, 12:45 AM
Last Post: snippsat
  Can't write to file Mark17 2 355 Sep-24-2021, 03:45 PM
Last Post: Mark17
  How to write in text file - indented block Joni_Engr 3 601 Aug-09-2021, 06:30 PM
Last Post: deanhystad
  Read csv file through PyCharm kimx0961 3 908 Aug-01-2021, 07:05 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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