| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- wecode
- 위코드
- 프리워커스
- 역사
- phython
- VSCode
- 파이썬
- comprehension
- dangerouslySetInnerHTML
- TIL #todayilearn #math #javascript #js #자바스크립트 #절댓값 #최댓값 #랜덤 #random #floor
- 싸피
- django
- html #css #코딩 #입문 #코딩시작하기 #코딩입문 #파이썬 #자바스크립트 #비전공자 #비전공 #코딩학원
- loaddata
- LIST
- vscode설치
- dumpdata
- 코딩
- Coding
- CSS
- Web
- listdir
- HTML
- 프로그래밍폰트
- Python
- 오블완
- SSAFY
- CSS #HTML #코드
- 티스토리챌린지
- 파라미터
- Today
- Total
목록Python (11)
당신의 친절한 이웃, 코딩맨
이해하기 쉬운 예제: Lambdas = [ lambda x : x ** 2, lambda x : x ** 3, lambda x : x ** 4 ] for lambda_func in Lambdas: print( lambda_func(2) ) import types f = lambda x,y,z : x+y+z print(f) print(type(f)) print( type(f) == types.LambdaType) type은 lambda로 나오지만 이외에 class타입도 함께 돼있는 것을 확인할 수 있다. def check_password(password): if len(password) < 8: return 'SHORT_PASSWORD' if not any(c.isupper() for c in passwo..
import time L = [ 1,2,3] def print_iter(iter): for element in iter: print(element) def lazy_return(num): print("sleep 1s") time.sleep(1) return num print("comprehension_list=") comprehension_list = [lazy_return(i) for i in L] #[1,2,3] print_iter(comprehension_list) print("generator_exp=") generator_exp = (lazy_return(i) for i in L) #[]를 ()로 바꿔줌. print_iter(generator_exp) comprehension_list= slee..
List comprehension은 for 반복문을 활용하여 list를 짧고, 빠르게 만들 수 있는 comprehension이다. [ 표현식 for 원소 in 반복 가능한 객체 ] [ 표현식 for 원소 in 반복 가능한 객체 if문 ] cities = ["Tokyo","Shanghai","Jakarta","Seoul","Guangzhou","Beijing","Karachi","Shenzhen","Delhi"] # 일반적인 for loop new_cities = [] for i in cities: if "S" not in i: new_cities.append(i) print(new_cities) # list comprehension n_l = [x for x in cities if "S" not in x..
① def func_param_with_var_args(name, *args, age): print("name=",end=""), print(name) print("args=",end=""), print(args) print("age=",end=""), print(age) func_param_with_var_args("정우성", "01012341234", "seoul", 20) - 옵셔널 파라미터 중 여러개의 파라미터를 입력받는 *arg 파라미터는 TIL#13에서 소개한 바와 같이, 제일 끝에 위치해야한다. - 해당 호출 argument에서 name과 age에 알맞은 값이 들어가게 순서를 바꾼다. 수정 후 def func_param_with_var_args(name, age, *args,): print(..