Register Python
June-19-16
Register-python.py - Install or remove python from current environment into the Windows registry
When asked to install:
If our python version and installpath is in registry: do nothing.
If our python version and different installpath: do nothing.
If our python is not there, add it.
When asked to remove:
If our python is not there: do nothing
If our python version and different installpath: do nothing.
If our python version and installpath is in registry: remove.
Original written by Joakim Löw for Secret Labs AB / PythonWare.
Modified by Matt Wilkie for OSGeo4W
http://trac.osgeo.org/osgeo4w/ticket/114
Adapted from:
http://www.pythonware.com/products/works/articles/regpy20.htm
http://effbot.org/zone/python-register.htm
http://timgolden.me.uk/python-on-windows/programming-areas/registry.html
Known problems:
Doesn't detect existing python registrations on 64bit machines,
see http://www.mail-archive.com/python-list@python.org/msg266397.html
Register Python
string1 = 'Hello'
string2 = 'hello'
if string1.lower() == string2.lower():
print "The strings are the same (case insensitive)"
else:
print "The strings are not the same (case insensitive)" But breaks on Unicode, accents, etc. We can deal with that in Python3 with:
import unicodedata
def normalize_caseless(text):
return unicodedata.normalize("NFKD", text.casefold())
def caseless_equal(left, right):
return normalize_caseless(left) == normalize_caseless(right) From < http://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison-in-python >
Future
Be nice to turn this into a Textualize app