0

I'm a newbie to Python and after much googling to no avail I wanted to see if I could get some help here. I'm trying to come up with a script to take lines from a textfile and insert them into specific places in another file. Here's a simple example:

I want to take lines from here:
#example.txt
apples
oranges
bananas

and end up with something like this:
#output.txt
Name of fruit: apples
Price: blahblah
Name of fruit: oranges
Price: blahblah
Name of fruit: bananas
Price: blahblah

Can anyone help or point me in the right direction? Thanks in advance!

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by pyTony
1

cplusplus, this is Python forum!
See Python tutorials for lists etc basic things. Experiment boldly interactively from Python command prompt. Build list, write it to file, read back in etc.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.