Python today's dog

import random
class Dog(object):
    _range = [1, 189]
    _base_url = 'http://www.robots.ox.ac.uk/~vgg/data/pets/data/images/{}_{}.jpg'
    dogs = ['shiba_inu','staffordshire_bull_terrier','shiba_inu','english_setter','great_pyrenees','leonberger','saint_bernard']
    @classmethod
    def today(cls):
        return cls._base_url.format(random.choice(cls.dogs), random.randint(*cls._range))

print Dog.today()

Wandbox http://melpon.org/wandbox/permlink/wYVzLWuBSxpg0Fac

Downlod http://www.robots.ox.ac.uk/~vgg/data/pets/

Sample alt alt alt

Recommended Posts

Python today's dog
Today's python error: killed
Today's python error: SyntaxError Non-ASCII character
Today's python error: image is blank
kafka python
Python basics ⑤
python + lottery 6
Python Summary
Python comprehension
Python technique
Studying python
Today's python error: ModuleNotFoundError: No module named
Python memorandum
Python FlowFishMaster
Python service
python tips
python function ①
Python basics
Python memo
ufo-> python (3)
Python comprehension
install python
Python Singleton
Today's python error: ModuleNotFoundError: No module named
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
atCoder 173 Python
[Python] function
Python installation
python tips
Installing Python 3.4.3.
Try python
Python memo
Python iterative
Python algorithm
Python2 + word2vec
[Python] Variables
Python sys.intern ()
Python tutorial
Python decimals
python underscore
Python summary
Start python
Note: Python
Python basics ③
python log
Python basics
[Scraping] Python scraping
Python update (2.6-> 2.7)
python memo
Python memorandum
Python # sort
ufo-> python
Python nslookup
python learning
Hannari Python 2020
What is a dog? Python installation volume
[Rpmbuild] Python 3.7.3.