[PYTHON] 코딩 규칙

1. 한줄의 문자길이 < 80

2. 변수, 함수는 lowercase_underscore

3. 클래스는 CapitalizedWord

4. 상수는 ALL_CAPS

5. if len(somelist)==0 대신 if not somelist

6. map함수 사용. map(function, something_iterable←배열, 리스트)

    * reduce(누적합), filter(조건검색), counter, set(중복제거)

7. 리스트/스트링에서 unique요소뽑기. set(변수명)

8. 한줄에 import 한개

[PYTHON] Comprehension: List[], Dictionary{}

List: [expr for x in iterable] / [expr for x in iterable if condition]

Dictionary: {key: value for x in iterable if condition}

[PYTHON] 데이터프레임 iterrows()

for index, row in data.iterrows():
    print(row['name'], row['age'])

[PYTHON] Print format, f-strings [ref.1]

~$ # f-strings (python 3.6~)

~$ name = 'Gildong Hong'; company='Ship com.'

~$ print(f"I am {name}, I belongs to {company})

[PYTHON] Simple IF statement

if m in [1,3,5,7]:  equal to if m==1 or m==3 or m==5 or m==7:

[PYTHON] any or all(a % 2 ==0 for a in range(0,10,2))

[PYTHON] Background running of python script: nohup

$nohup python *.py & (터미널을 종료하더라도 백그라운드에서 계속 실행)

- $ps u / x : 사용자 실행 프로세스 / 모든 프로세스

- $kill pid : 프로세스 종료하기

[PYTHON] Lambda function

function_name = lambda argument: expression

* square = lambda x: x^2 => square(2) => 4

[PYTHON] Self-Testing Code

if __name__ == "__main__":
    # Self-testing code goes here.
else:
    # This will be executed in case the source has been imported as a module.

[HTML] Hyperlink directing new windows and without underline  [ref.1][ref.2]

새창으로 열기: <a href="www.google.com" target="_blank" rel="noopener">구글로 이동</a>

하이퍼링크 선 없애기: <a href="www.google.com" target="_blank" rel="noopener" style="color: #034199; text-decoration: none;">구글로 이동</a>