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
#1
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
Reply
#2
Please read: https://python-forum.io/misc.php?action=help&hid=52
We will be glad to help, but you must make an effort.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Last record in file doesn't write to newline gonksoup 3 364 Jan-22-2024, 12:56 PM
Last Post: deanhystad
  file open "file not found error" shanoger 8 946 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Recommended way to read/create PDF file? Winfried 3 2,784 Nov-26-2023, 07:51 AM
Last Post: Pedroski55
  write to csv file problem jacksfrustration 11 1,373 Nov-09-2023, 01:56 PM
Last Post: deanhystad
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 1,312 Nov-09-2023, 10:56 AM
Last Post: mg24
Question Special Characters read-write Prisonfeed 1 582 Sep-17-2023, 08:26 PM
Last Post: Gribouillis
  Need to replace a string with a file (HTML file) tester_V 1 699 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  How can I change the uuid name of a file to his original file? MaddoxMB 2 874 Jul-17-2023, 10:15 PM
Last Post: Pedroski55
  read file txt on my pc to telegram bot api Tupa 0 1,049 Jul-06-2023, 01:52 AM
Last Post: Tupa
  parse/read from file seperated by dots giovanne 5 1,043 Jun-26-2023, 12:26 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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