본문 바로가기

Language

(31)
python logging 예제 logging debug < info < warning < error < critical파이썬 로깅의 기본 설정은 warning이다. 그래서 import logging을 했을 경우, warning ~ 만 출력이 된다. 로깅의 기본설정을 바꿔야 debug, info level를 출력할 수 있다. 기본설정을 바꾸는 방법은 아래와 같다.import logging mylogger = logging.getLogger("my") mylogger.setLevel(logging.DEBUG) 출력 형식을 변경할 수도 있다. 하는방법은 아래와 같다.import logging ''' 생성 시간 : %(acstime)s 로깅 레벨 : %(levelname)s 라인 번호 : %(lineno)s 로그 내용 : %(message)..
python chrome password import os, sys import win32crypt import sqlite3 sys.path.append(os.path.abspath(os.path.dirname(__file__)) + "\\..\\") import common def getpath(_browser): if (_browser == "chrome"): path = os.getenv('localappdata') + "\\Google\\chrome\\User Data\\Default\\" if (_browser == "whale"): path = os.getenv('localappdata') + "\\Naver\\Naver Whale\\User Data\\Default\\" return path def decryp(_path): tr..
c++ thread, mutex, atomic C++ Thread#include // 선언. using namesapce std; void somefunction() { for (int cnt =0; cnt < 1000; ++cnt) cout
c++ vector capacity vector capacityvector에 할당되는 메모리크기를 알아보는 방법이다.#include #include using namespace std; int main() { vector v1; for (int cnt = 0; cnt
python pysqlite pysqlitesqlite는 별도의 DB 서버 필요없이 db 파일에 기초하여 DataBase 처리를 구현한 Embedded SQL DB Engine이다. python에는 pysqlite로 존재하며, python 2.5 이상부터 기본적으로 내제되어있다. 사용할땐, import sqlite3을 통해 불러온다. sqlite3의 간략 사용법.import sqlite3 ''' db파일이 존재하지 않는다면 새로운 파일을 만들어준다. connection이 되면 connection 객체가 리턴된다. 해당 객체로부터 cursor를 생성하고 cursor 객체의 execute()를 사용하여 sql 쿼리를 실행. ''' conn = sqlite3.connect() #연결 with conn: cur = conn.cursor()..
c++ Operator Operator int +#include #include #include using namespace std; class addOperator{ private: int a = 1; public: addOperator() {}; ~addOperator() {}; void getnum() { cout a a + ad.a; return temp; */ this->a += ad.a; return *this; } addOperator operator-(const addOperator &ad) { addOperator temp; temp.a = this->a - ad.a; return temp; } }; int main(int argc, char* argv[]){ addOperator temp1, temp2; (t..
python closure, decorator Closure ex 1 )# python 3.x def MyFunction(text): def innerFunction(): return print("receive string is {}".format(text)) return innerFunction test_Function = MyFunction("Hello World!") test_Function() ex 2 )# python 3.x def MyFunction(originFunction): def innerFunction(): print (" This is innerFunction ") return originFunction() return innerFunction def doSomething(): print ("Hello World!") test_..