3 Answers
+ 4
from zipfile import ZipFile
with ZipFile("Name1.zip", "w") as any:
any.write("Name2.py")
any.write("Name3.txt")
any. write("Name4.md")
#Name 1 refers to the name of the zip you're trying to make
#Name 2,3,4, etc refers to the different types of file you wish to 'zip together'(i.e put in a zip file)
#The condition is that Name2,3,4, etc must all be in the same directory/folder
+ 7
If the file is not too big, you could store it inside your program as a multiline string, like
text = """
This
is your
text file.
"""
+ 4
Tibor Santa , thanks for your feedback