Python Forum

Full Version: What would be a substitute for "::"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The use of :: is prohibited for certain assignments, what would be a substitute that would allow you to do things like print every other character in a string?
If slicing is allowed for the object,  you can use it directly, e.g.:

'a string'[slice(None, None, 2)]