Added day 7
This commit is contained in:
19
scripts/new.py
Normal file
19
scripts/new.py
Normal file
@ -0,0 +1,19 @@
|
||||
def create_and_populate_file(file_name, content):
|
||||
try:
|
||||
with open(file_name, 'w') as file:
|
||||
file.write(content)
|
||||
print(f"File {file_name} created and populated successfully.")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
def main():
|
||||
# Define the file names and template content
|
||||
file_names = ["file1.txt", "file2.txt", "file3.txt"]
|
||||
template_content = "This is a template file.\nYou can replace this content."
|
||||
|
||||
# Create and populate each file
|
||||
for file_name in file_names:
|
||||
create_and_populate_file(file_name, template_content)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user