μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
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 |
Tags
- ubuntu
- νμ΄μ¬ μκ³ λ¦¬μ¦
- λ°±μ€ λ¬μ€νΈ
- java
- λ¬μ€νΈ μμ
- Rust
- νμ΄μ¬ μ±λ¦°μ§
- λ°±μ€
- νμ΄μ¬
- μ€λΌν΄DB
- λ°μ΄ν°λ² μ΄μ€
- μλ° κ°λ
- Operating System
- μλ° κΈ°μ΄
- Database
- μ°λΆν¬
- Python
- μ€λΌν΄
- Reversing
- λ¬μ€νΈ
- Python challenge
- μκ³ λ¦¬μ¦
- μ΄μ체μ
- μλ°
- νμ΄μ¬ μ²Όλ¦°μ§
- λ°μ΄ν° ν΅μ
- C
- λ¬μ€νΈ νλ‘κ·Έλλ° κ³΅μ κ°μ΄λ
- OS
- data communication
Archives
- Today
- Total
IT’s Portfolio
[Python] eval(), exec()μ λν΄μ λ³Έλ¬Έ
728x90
λ°μν
π» eval()κ³Ό exec()
- νμ΄μ¬ λ΄μ₯ν¨μ
- λ¬Έμμ΄λ‘ ννλ νμ΄μ¬ μ½λ μ€ν μ μ¬μ©νλ ν¨μ
ππ» eval()
evaluateμ μ½μ
- λ§ κ·Έλλ‘ κ°μ ꡬνλ ν¨μ
νλΌλ―Έν°λ‘ 'μ'μ λ°μ μ»΄νμΌ μ½λλ‘ λ³νν¨
- exec()μ λ¬λ¦¬ 'λ¬Έ'μ νλΌλ―Έν°λ‘ λ°μ μ μμ
κ°μ λ°ννλ ν¨μ
a = 5 b = 6 a = eval('a+b') print(a) >>> 11
ππ» exec()
executeμ μ½μ
- λ§ κ·Έλλ‘ μ€ννλ ν¨μ
νλΌλ―Έν°λ‘ λ°μ 'λ¬Έμμ΄'μ μ»΄νμΌ μ½λλ‘ λ³ννμ¬ μ€νν¨
κ°μ λ°ννμ§ μλ ν¨μ
a = 5 b = 6 exec("print(a, '+', b, '=', a+b);a+=1;b+=1;"*3) >>> 5 + 6 = 11 6 + 7 = 13 7 + 8 = 15
728x90
λ°μν
'Development Study > Python' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[Python] νμ΄μ¬μ λ¬Έμμ΄ ν¬λ©ν Ver.2 (0) | 2022.10.06 |
---|---|
[Python] λΉνΈ μ°μ°μ (0) | 2022.10.01 |
[Algorithm] Baekjoon - 쑰건문 λ¨κ³ (0) | 2022.08.05 |
[Python] νμ΄μ¬μμ '_, *, **' μλ―Έ (0) | 2022.08.05 |
[Python] open(0)κ³Ό sys.stdin (0) | 2022.08.02 |
Comments