Python Forum

Full Version: Read file, reformat and write new file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

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: www.superiorcarehomes.com \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
Contact
Owner: Mrs Karalia

Phone: 0114 286 9753
Email: [email protected]
Website: www.superiorcarehomes.com
Abberton Manor Nursing Home26 beds
Contact
Owner: Mrs Hooper

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

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

Phone: 01492 530955
Email: [email protected]
Website: www.adheare.co.uk

Many thanks
Please read: https://python-forum.io/misc.php?action=help&hid=52
We will be glad to help, but you must make an effort.