geekcomputers / geekcomputers/Python
Capitalize an output file name (date)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 35.4k
- Forks
- 12.9k
- Avg merge
- 2h 37m
- Merged PRs (30d)
- 1
Description
I have this code that results in: 2018_Aug_TCRArchive.pdf - a simple request has come in to capitalize the month... i.e. 2018_AUG_TCRArchive.pdf - why can't I figure this out?? Thanks in advance (FYI, I took over this code from another employee who is no longer here, and I don't 100% understand the code quite yet).
d = datetime.date.today()
if not d.month == 1:
dSubtracted = datetime.date(d.year,d.month-1,d.day)
else:
dSubtracted = datetime.date(d.year-1,12,d.day)
mxd = arcpy.mapping.MapDocument(r"C:\Mxds\TCRArchive.mxd")
outputpath = 'r"C:\Pdfs'
pdfarchivefilename = '{:%Y_%b_%d}_TCRArchive.pdf"'.format(dSubtracted)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the date-formatting expression that builds pdfarchivefilename in the issue body, along with the surrounding date and PDF export code. Run the script with a representative date and verify that the generated filename uses an uppercase month abbreviation while retaining the year, day, and suffix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100