[Python] 함수

count=0 def func(a,b=1):    #두번째 인수에 기본값 설정     “func() is tutorial function” #함수 문서화 문자열     global count    #전역 변수를 함수 내에서 사용     count += 1     print “call count : %d” % count     print a,”+”,b     return a+b print func(4,5) print func(9) print func.__doc__

[Python] 집합 (데이터 순서 없음, 중복값 없음)

set1 = set([1,2,3,4]) set2 = set(“hello”)     #중복값은 제거됨 (helo) set1.add(5)     #값 1개 추가 set1.update([6,7,8])    #값 여러개 추가 set2.remove(‘e’)    #값 제거 set1 | set2     #합집합 set1 & set2     #교집합 set1 – set2     #차집합 set1 ^ set2     #대칭차집합 (교집합 반대)

[Python] 사전

dic1 = {“item1” : “123”, “item2” : 456, “item3” : “data”} dic2 = {}   #빈 사전 생성 dic3 = dict()   #빈 사전 생성 dic1[“item4”] = “data2” #키 추가 del dic1[“item3”]       #키 삭제 if “item2” in dic1:     #사전에 해당 키가 있는지 확인     i=dic1[“item2”] else:     i=0 j=dic1.get(“item2”,0) … Read more

[Python] 리스트

list1 = [“123″,”456″,”abc”] list1[0] #색인은 0부터 (0~2) list1.append(“new data”) #새 항목 추가 list1.insert(1,”ins”) #idx 1위치에 항목 추가 list1[1:2] #idx 1부터 idx 2 이전까지 (idx 1만 출력) list1[1:] #idx 1부터 끝까지 list2=[] #빈 리스트 생성 list3=list() #빈 리스트 생성

[Python] 반복문

data1 = range(1,10) #1~9의 값을 가지는 리스트 생성 data2 = 0 for i in data1:     print i while data2 < 10:     data2+=1     if data2 % 2:         print data2,    #홀수면 출력     else:         continue    #짝수면 아래 구문 무시하고 반복문 ... Read more

[Python] 조건문

#조건문 a=1 b=2 c=3 d=4 s=”show me the money”  x=[1,2] y=[1,2] if a < b:     print “bbbb” elif b < a:     print “aaaa” else:     print “aabb” if a < b and b < c and not (d < c):     print “dddd” if “money” in s: # 좌측 ... Read more

[Python] 입출력 (stdin, stdout)

import sys i=0.5353 s=”text” t=sys.argv[0]   #명령줄 인수를 읽어옴 print “Hello World %.2f %d” % (i,2016) # 파이썬 3에서는 print 다음에 ()가 들어감 ex: print(“Hello World %.2f %d” % (i,2016)) print “file name is %s” % (t) print format(i,”10.2f”),format(s,”20s”),”123″   #format 함수의 2번째 인자는 포맷지정자 sys.stdout.write(“input : “) t=sys.stdin.readline() print t t= raw_input(“input : “)   … Read more

T wifi Zone 삭제/제거하기

-테스트 환경 베가 LTE-A 젤리빈 & 킷캣 ※킷캣은 현재 삭제가 되어도 T wifi Zone이 검색이 되면 다시 자동으로 연결되는 문제가 발생하여 테스트중입니다. -준비물 1.루팅된 단말기 2.Root Explorer 등 파일 탐색기 3.헥스 에디터 (010Editor 등) [1] /system/bin/wpa_supplicant 추출 Wifi 세팅을 담당하는 /system/bin/wpa_supplicant 파일을 복사하여 외장 메모리 또는 내장 메모리에 복사하여 PC로 이동합니다. [2]Hex Editor로 wpa_supplicant 바이너리 수정 … Read more

Windows Event Log 설정

상단이 Windows Ver.5(2000, XP, 2003 등)의 이벤트로그 설정, 하단이 Windows Ver.6(Vista, 7, 2008 등)의 이벤트로그 설정이며, 보는바와 같이 Ver.6 에서는 날짜 기준 덮어쓰기 설정이 제거되고 “로그가 꽉 차면 로그 보관” 항목이 새롭게 추가되었으며, “필요한 경우 덮어쓰기” 옵션에 ‘(가장 오래된 이벤트 먼저)’ 라는 문구가 추가되었다. 우선 Ver.5에서 ‘(가장 오래된 이벤트 먼저)’ 라는 문구가 없지만 동일하게 동작하는지 확인해보았다. 위쪽이 … Read more

바로가기