1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zepelin [54]
3 years ago
15

Write a program that will generate a personalized invitation within a text file for each guest in the guest list file using the

event information found in the event details file. Put all the generated invitation files in a directory called invitations. Ensure that the name of each invitation file uniquely identifies each guest's invitation
Computers and Technology
1 answer:
vlada-n [284]3 years ago
7 0

Answer:

Code:  

import os   # os module to create directory  

event_file = open("event_details.txt", "r") # Getting event file  

event_details = ""  # event details to be stored  

for row in event_file:  # traversing through the event_file  

   event_details += row    # appending event details  

os.mkdir("./invitations")   # make directory in the same parent directory  

names = open("guest_list.txt", "r") # getting names of the people  

for name in names:  # traversing through names in guest_list file

   name = name.replace('\n', '')   # removing the ending '\n' from the name  

   invitation_msg = "Hi! " + name + ", You are heartly invited in the Ceremony.\nAt " + event_details # Generating the invitation message  

   file_name = '_'.join(name.split(' '))   # Spliting name in space and joining with the '_'  

   file_path = "./invitations/" + file_name + ".txt" # Generating each file path  

   invite_file = open(file_path, "w")  # Creating the file for each name  

   invite_file.write(invitation_msg)   # Write invitation to file

Output:

You might be interested in
HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP!!!
Bingel [31]

Answer:

different or difference between Dot-matrix and Daisy-wheel printer

3 0
3 years ago
There are some network modeling tools that can ________ the existing network.
lesya [120]
<span>There are some network modeling tools that can scan the existing network.</span>
4 0
3 years ago
Read 2 more answers
Is a defense of a political position an argument
shutvik [7]

Answer:

yes

Explanation:

yyyyyyyyyyeeeeeeeeesssssss

8 0
2 years ago
Jenny needs to record the names of 30 students, write down the subjects they studied, and note their grades in each subject afte
lidiya [134]

Answer:

<em>The </em><em>answer </em><em>is </em><em>(</em><em>A)</em>

Explanation:

Double-click both the worksheet tabs one at a time and then enter the new names.

6 0
2 years ago
A web designer must effectively communicate when he/she designs a web page. If there is too much information to put onto one pag
valina [46]
Usually they'll add a link to the bottom of the page to the next page.

7 0
3 years ago
Other questions:
  • With a _____ network connection, the computers and other devices on the network are physically connected via cabling to the netw
    10·2 answers
  • What is <br> Warehouse schema.
    14·1 answer
  • Give a recursive algorithm for finding the sum of the<br> first n odd positive integers.
    8·1 answer
  • A powerful computer that acts as a hub for other computers is a called a ______.
    6·2 answers
  • A major difference between digital librarians and traditional librarians is that traditional librarians rarely work with people.
    15·2 answers
  • Information is best described as
    10·1 answer
  • Memory cache is referred to as ______. A. SRAM c. SROM b. DRAM d. DROM
    11·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    5·1 answer
  • Who designed the apple i computer in 1976?
    13·1 answer
  • Besides a soho router, which of these devices is a network printer most likely to be connected to? a. router b. server c. workst
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!