μΌ | μ | ν | μ | λͺ© | κΈ | ν |
---|---|---|---|---|---|---|
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
- Reversing
- λ¬μ€νΈ μμ
- μκ³ λ¦¬μ¦
- λ°±μ€ λ¬μ€νΈ
- Database
- Rust
- μλ° κ°λ
- λ°±μ€
- Python
- μλ° κΈ°μ΄
- java
- μ€λΌν΄DB
- Operating System
- νμ΄μ¬
- μ°λΆν¬
- λ¬μ€νΈ
- νμ΄μ¬ μ±λ¦°μ§
- νμ΄μ¬ μκ³ λ¦¬μ¦
- OS
- Python challenge
- λ°μ΄ν°λ² μ΄μ€
- μ΄μ체μ
- μλ°
- C
- 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