redis-python db=0 parameter used for?
Redis by default consists of 16 logical databases. Starting from 0 index and ending with 15.
That's why db parameter is used.
When we start redis-cli it's show or used 0 index logical database.
If you want to change the default 0 index database run this command select 1 #index 1 logical database selected
After this we can run different commands specific to selected database. In our case we are using 1 index logical database.
flushdb swapdb
Note In redis cluster we can't used select command and only support 0 database.
By default, redis has 16 databases, which can be addressed by their indexes. This is what it's for.
See SELECT command.