import warnings
def test_lower(self): self.assertTrue(strop.lower("HeLLo") == "hello")
# To fix a problem with Pythonwin when started from the Pythonwin directory, # we update the pywin path to ensure it is absolute. # If it is indeed relative, it will be relative to our current directory. # If its already absolute, then this will have no affect. import pywin, pywin.framework pywin.__path__[0] = win32ui.FullPath(pywin.__path__[0]) pywin.framework.__path__[0] = win32ui.FullPath(pywin.framework.__path__[0]) # make a few wierd sys values. This is so later we can clobber sys.argv to trick # scripts when running under a GUI environment. moduleName = "intpyapp" sys.appargvoffset = 0 sys.appargv = sys.argv[:] # Must check for /app param here. if len(sys.argv)>=2 and strop.lower(sys.argv[0])=='/app': import cmdline moduleName = cmdline.FixArgFileName(sys.argv[1]) sys.appargvoffset = 2 newargv=sys.argv[sys.appargvoffset:] # newargv.insert(0, sys.argv[0]) sys.argv = newargv exec "import %s\n" % moduleName try: win32ui.GetApp()._obj_ # This worked - an app already exists - do nothing more except (AttributeError, win32ui.error): # This means either no app object exists at all, or the one # that does exist does not have a Python class (ie, was created
import strop import sys # assuming we have an executable named ".../executable", add a # directory named ".../executable-extra" to the path if strop.lower(sys.executable)[-4:] == ".exe": extra = sys.executable[:-4] # windows else: extra = sys.executable sys.path.insert(0, extra + "-extra") import mymodule
import strop print repr(strop.whitespace) import string print repr(string.whitespace) print repr(string.lowercase) print repr(string.uppercase) all_chars = ''.join(chr(i) for i in xrange(256)) print repr(strop.lower(all_chars))
# To fix a problem with Pythonwin when started from the Pythonwin directory, # we update the pywin path to ensure it is absolute. # If it is indeed relative, it will be relative to our current directory. # If its already absolute, then this will have no affect. import pywin, pywin.framework pywin.__path__[0] = win32ui.FullPath(pywin.__path__[0]) pywin.framework.__path__[0] = win32ui.FullPath(pywin.framework.__path__[0]) # make a few wierd sys values. This is so later we can clobber sys.argv to trick # scripts when running under a GUI environment. moduleName = "intpyapp" sys.appargvoffset = 0 sys.appargv = sys.argv[:] # Must check for /app param here. if len(sys.argv) >= 2 and strop.lower(sys.argv[0]) == '/app': import cmdline moduleName = cmdline.FixArgFileName(sys.argv[1]) sys.appargvoffset = 2 newargv = sys.argv[sys.appargvoffset:] # newargv.insert(0, sys.argv[0]) sys.argv = newargv exec "import %s\n" % moduleName try: win32ui.GetApp()._obj_ # This worked - an app already exists - do nothing more except (AttributeError, win32ui.error): # This means either no app object exists at all, or the one # that does exist does not have a Python class (ie, was created