Last active
January 26, 2019 08:08
-
-
Save jieniu/b8e8ac48871e8eec54df89a1e66c690f to your computer and use it in GitHub Desktop.
python gist
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
# mock side_effect | |
>>> iter_mock = mock.Mock(side_effect=[1, 2, 3]) | |
>>> iter_mock() | |
1 | |
>>> iter_mock() | |
2 | |
>>> iter_mock() | |
3 | |
# n days ago | |
from datetime import datetime, timedelta | |
date_N_days_ago = datetime.today() - timedelta(days=1) | |
str = date_N_days_ago.strftime('%Y%m%d') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment