#๐Ÿ”’ I need help extracting the right date from my file name

15 messages ยท Page 1 of 1 (latest)

viral groveBOT
#

@viral hinge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

magic wing
#

!e

from datetime import datetime

filename = "vso_health_check_20230911_1948.csv"
date_str = filename.split('_')[3][:8]
check_date = datetime.strptime(date_str, '%Y%m%d').date()
print(check_date)
viral groveBOT
magic wing
#

looks fine

viral hinge
magic wing
#

That's what I did?

That's an example showing that your code works

viral hinge
magic wing
#

Yeah I missread that, sorry.

Sure.

viral groveBOT
#

Hey @viral hinge!

It looks like you are trying to paste code into this channel.

You seem to be using the wrong symbols to indicate where the code block should start. The correct symbols would be ```, not '''.

Here is an example of how it should look:
```
Hello, world!
```

This will result in the following:

Hello, world!```
You can **edit your original message** to correct your code block.
magic wing
#

Is that chatgpt code?

#

I have no idea

viral hinge
#

got you

viral groveBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.