I am trying to read through a windows batch script and replicate its function in python. However, I have come across a statement I am not familiar with… Having little experience with batch myself.
set variable = %variable:~-2%
Can anyone explain to me what this means?
This will take the last 2 characters from
variableand assign the result tovariable.For example:
See the “Substrings” section here for reference, and more examples.