The problem of python step size

clipboard.png

list [- 1:] doesn"t this mean starting from the end? Why does the default step size of 0-1 mean 9
, but list [0: 4:] this step size represents 1?

Mar.20,2021

  1. step size defaults to 1, not 0;
  2. test [a li b], a, b two numbers only declare an interval, indicating that the value taken is within the interval of the source list, and the specific value is taken according to the step size. < / value >

you can refer to my article:
https://codeshelper.com/a/11.

.

list [- 1list:] step length is also 1
list [- 1br:] means starting with list -1 starting with a step size of 1 (the second step is followed by the step size, there is no default of 1), to the end (the first is the end position, and there is no default to the last element of the list), so take 9 first, and then take the list to end.
so return [9]

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3db84-2c3e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3db84-2c3e4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?