Python vba to create a date string for creating a file name

Creating a file name is essential for scraping. Is the file name most often date + serial number? In many cases, date + time is fine, but If the number is small, the date + serial number is the most popular, so I made a note of how to create the file name.

For Python

Premise Windows Python3.7 The following is when creating a CSV file name with date + serial number If you format datetime.date.today () with strftime, it can be treated as a character string. You can add the desired string to the end.

python


import datetime
hizuke = datetime.date.today()
hizuke = hizuke.strftime('%Y-%m-%d')
file1 = hizuke+"-1.csv"  #2020-08-11-1.csv * Today's date
file2 = hizuke+"-2.csv"    #2020-08-11-2.csv

Click here for detailed date format https://docs.python.org/ja/3.6/library/datetime.html#strftime-strptime-behavior

For vba

vba


 Dim strFileNm As String
 strFileNm = Format(Now(), "yyyy-mm-dd") & "-1.csv" '2020-08-11-1.csv * Today's date

Click here for detailed date format https://docs.microsoft.com/ja-jp/dotnet/api/microsoft.visualbasic.strings.format?view=netcore-3.1

In the case of vba, the date formatting is the same as the one used in Excel, so it is familiar.

Recommended Posts

Python vba to create a date string for creating a file name
How to create a JSON file in Python
Parse a JSON string written to a file in Python
[python] Convert date to string
Python script to create a JSON file from a CSV file
[python] Change the image file name to a serial number
[Python] Create a date and time list for a specified period
Create a message corresponding to localization with python translation string
Create a binary file in Python
5 Ways to Create a Python Chatbot
Create a random string in Python
How to create a config file
[For Python] Quickly create an upload file to AWS Lambda Layer
Creating a simple PowerPoint file with Python
Let's create a virtual environment for Python
[Python] How to invert a character string
Create a deb file from a python package
[GPS] Create a kml file in Python
Script to create a Mac dictionary file
Things to watch out for when creating a Python environment on a Mac
Create a shortcut to run a Python file in VScode on your terminal
[Python] Create a linebot to write a name and age on an image
[Python / Tkinter] Search for Pandas DataFrame → Create a simple search form to display
Tips for Python beginners to use Scikit-image examples for themselves 3 Write to a file
[Python] List Comprehension Various ways to create a list
Edit Excel from Python to create a PivotTable
How to read a CSV file with Python 2/3
Create a GIF file using Pillow in Python
How to create a Python virtual environment (venv)
How to embed a variable in a python string
How to create a function object from a string
Create a LINE BOT with Minette for Python
I want to create a window in Python
Procedure for creating a LineBot made with Python
Python Note: When assigning a value to a string
Steps to create a Twitter bot with python
How to create a shortcut command for LINUX
Commands for creating a python3 environment with virtualenv
Export Python3 version OpenCV KeyPoint to a file
Procedure for creating a Python quarantine environment (venv environment)
Create a datetime object from a string in Python (Python 3.3)
Create a Photoshop format file (.psd) with python
Create a MIDI file in Python using pretty_midi
A memo for creating a python environment by a beginner
I want to write to a file with Python
String to Unicode Escape Sequence Format for Python
[Python] Create a list of date and time (datetime type) for a certain period
I want to create a nice Python development environment for my new Mac
[Python] I tried to get the type name as a string from the type function
<Python> A quiz to batch convert file names separated by a specific character string as part of the file name
Create a dataset of images to use for learning
Create a Python module
[Python] 2 Create a risk-return map for your asset portfolio
Create a plugin to run Python Doctest in Vim (2)
[Go] How to create a custom error for Sentry
A memorandum to run a python script in a bat file
[Introduction to python] A high-speed introduction to Python for busy C ++ programmers
I want to randomly sample a file in Python
Steps from installing Python 3 to creating a Django app
[Python2] Date string-> UnixTime-> Date string
Python program that looks for the same file name