According to the Markdown help article:
For Documentation with multiple groups of versions (ie. .NET, which has Core and Micro Frameworks), you must include the group name in the HTML comment before the conditional.
<!-- if version <Named Framework> [gte 2.0] -->
Content relevant to Named Framework versions 2.0 and greater.
<!-- end version if -->
Since Python has 3.x and 2.x version groups, you need to add the group:
<!-- if version <Python 2.x> [gte 2.3] -->
print('Hello, world')
<!-- end version if -->
I don't think ranges work with version groups, however.
The other thing to note is that the version has to match the list of versions in the introductory topic at the time the topic is submitted. Since many minor versions were removed from the Python tag, it may be necessary to edit versions that already exist in an example even if that's not the edit you'd planned to make.