method of string
(sandbox) PS G:\workspace\py\sandbox\standards> python Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> dir('') >>> for i in dir(''): ... print(i) ... __add__ __class__ __contains__ __delattr__ __dir__ __doc__ __eq__ __format__ __ge__ __getattribute__ __getitem__ __getnewargs__ __gt__ __hash__ __init__ __init_subclass__ __iter__ __le__ __len__ __lt__ __mod__ __mul__ __ne__ __new__ __reduce__ __reduce_ex__ __repr__ __rmod__ __rmul__ __setattr__ __sizeof__ __str__ __subclasshook__ capitalize ## casefold center count encode endswith ## expandtabs find format ## format_map index isalnum ## isalpha ## isdecimal ## isdigit ## isidentifier islower ## isnumeric ## isprintable isspace ## istitle isupper ## join ## ljust lower ## lstrip maketrans partition replace ## rfind rindex rjust rpartition rsplit rstrip ## split ## splitlines startswith ## strip ## swapcase title translate upper ## zfill >>> quit()
workon
Before coding , first check the environment on PC.
PS G: > $Env:PROJECT_HOME G:\workspace\py PS G: > $Env:WORKON_HOME G:\env\py PS G: >cd $Env:PROJECT_HOME PS G:\workspace\py> workon Pass a name to activate one of the following virtualenvs: ============================================================================== djanbox djfirst djfourth djsecond djthird sandbox
django-admin startapp
procedure
(djanbox) PS G:\workspace\py\djanbox> django-admin --version 2.0.6 (djanbox) PS G:\workspace\py\djanbox> explorer . (djanbox) PS G:\workspace\py\djanbox> (djanbox) PS G:\workspace\py\djanbox> django-admin startapp upload (djanbox) PS G:\workspace\py\djanbox> sakura .\djanbox\settings.py
start working on virtualenvwrapper
procedure
PS G:\Users\sakai> cd $Env:PROJECT_HOME PS G:\workspace\py> workon Pass a name to activate one of the following virtualenvs: ============================================================================== djanbox djfirst djfourth djsecond djthird sandbox PS G:\workspace\py> cd .\djanbox\ PS G:\workspace\py\djanbox> .\onme.ps1 (djanbox) PS G:\workspace\py\djanbox> pip freeze Django==2.0.6 pytz==2018.4
- onme.ps1
$p= $PWD.Path.split("\")[-1] cd $Env:workon_home\$p .\Scripts\activate cd $Env:project_home\$p
inspect.stack()
inspect.stack()
# ----------------------------------------- # def _get_funcname(): return inspect.stack()[1][3] def sample(): logger = logging.getLogger(__name__) logger.debug('begin ------> {}()'.format(sys._getframe().f_code.co_name)) logger.debug('begin ------> {}()'.format(inspect.stack()[0][3])) logger.debug('begin ------> {}()'.format(_get_funcname()))
#============================================================ #DateTime : Sunday, June 10, 2018 4:32:51 PM #CmdLine : python G:\workplace\py\sandbox\inspect_sample.py run #============================================================ [2018/06/10 16:32:51][DEBUG](inspect_sample.py:45:process) {'--help': False, '--version': False, 'run': True} [2018/06/10 16:32:51][DEBUG](inspect_sample.py:53:process) run -------------------- [2018/06/10 16:32:51][DEBUG](inspect_sample.py:35:sample) begin ------> sample() [2018/06/10 16:32:51][DEBUG](inspect_sample.py:36:sample) begin ------> sample() [2018/06/10 16:32:51][DEBUG](inspect_sample.py:37:sample) begin ------> sample()
// --- end of blog
os.path
os.path
def _sample(): logger = logging.getLogger(__name__) logger.debug('__file__ name : {}'.format(__file__)) logger.debug('basename : {basename}'.format(basename=os.path.basename(__file__))) logger.debug('dirname : {dirname}'.format(dirname=os.path.dirname(__file__))) logger.debug('abspath : {abspath}'.format(abspath=os.path.abspath(__file__)))
- log
[2018/06/10 12:00:24][DEBUG](utils.py:35:_sample) __file__ name : G:\workplace\py\sandbox\batch_sample\utils.py [2018/06/10 12:00:24][DEBUG](utils.py:36:_sample) basename : utils.py [2018/06/10 12:00:24][DEBUG](utils.py:37:_sample) dirname : G:\workplace\py\sandbox\batch_sample [2018/06/10 12:00:24][DEBUG](utils.py:38:_sample) abspath : G:\workplace\py\sandbox\batch_sample\utils.py
PROJECT_HOMEを開く
G:> explorer $Env:PROJECT_HOME