Closed activus-d closed 1 year ago
@Stormheg @thibaudcolas @allcaps kindly review my solution to this task:
import csv
locales = ["en", "is", "en_GB"]
versions = ["latest", "4.1.x", "4.2.x"]
def generate_combinations(locales, versions):
combined_list = []
for locale in locales:
for version in versions:
combined_list.append(f"{locale}-{version}")
return combined_list
def create_csv():
list = generate_combinations(locales, versions)
with open("combinations.csv", 'w') as file:
writer = csv.writer(file)
return writer.writerow(list)
create_csv()
Based upon programming task #1 – Given a list of locales (
["en", "is", "en_GB"]
), and a list of versions (["latest", "4.1.x", "4.2.x"]
), generate a CSV file ready to import with Wagtail’s bulk redirects importer.CSV file sample:
This helps practice: