본문 바로가기

전체 글

[python] string format Why is %s better than + for concatenation? hello = "hello" world = "world" print hello + " " + world print "%s %s" % (hello, world) print "{} {}".format(hello, world) print ' '.join([hello, world]) Readability. The format string syntax is more readable, as it separates style from the data. Also, in Python, %s syntax will automatically coerce any non str types to str; while concatenation only wor.. 더보기
[python] swap a, b = 1, 5 a, b = b, a 더보기
[vim] python setting in vim python and vim setting reinstall /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew update brew install vim vim --version | grep "python" What is 'ctag' http://bowbowbow.tistory.com/15 brew install ctags pip --version' check for python 3.6, if you not just type 'pip3' 7.pip install pep8 flake8 pyflakes isort yapf https://raw.githubusercontent... 더보기
[python] 파이썬 인스턴스 변수와 클래스 변수 공부하다가 파이썬은 클래스 속성값에 대해서 프로퍼티 데커레이터 이용해서 프로퍼티 맹글링해서 의도적인 직접접근 방지 그래서 파이써닉한거는 속성을 안써주는a건줄알았는데.. 애초에 클래스 변수와 인스턴스 변수가 있었음 >>> class Account: num_accounts = 0 def __init__(self, name): self.name = name Account.num_accounts += 1 def __del__(self): Account.num_accounts -= 1 >>> class Account: num_accounts = 0 def __init__(self, name): self.name = name Account.num_accounts += 1 def __del__(self): Accou.. 더보기
[elasticsearch] error ./elasticsearch Exception in thread "main" 2017-10-18 23:45:59,335 main ERROR No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging. 2017-10-18 23:45:59,393 main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBea.. 더보기
[anaconda] trouble with anaconda python and zsh in mac 1. open zshrc file by vim vim ~/.zshrc 2. add this code (not edit) export PATH="/Users/username/miniconda3/bin:$PATH" 더보기