Created
November 2, 2023 11:44
-
-
Save nsdevaraj/b9aa7bf2169080152ce0ec936c81c594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
# Open a CSV file for writing | |
with open('years_and_months.csv', 'w', newline='') as csvfile: | |
# Create a CSV writer | |
csvwriter = csv.writer(csvfile) | |
# Write the header | |
csvwriter.writerow(['Year', 'Month']) | |
# Generate data for the next 100 years | |
for year in range(2023, 2123): | |
for month in ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']: | |
csvwriter.writerow([year, month]) | |
print("Data generation complete. Check 'years_and_months.csv'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment