Skip to content

Commit

Permalink
[김진아] 6주차 미션 제출 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaniz authored May 13, 2024
1 parent 5baeca9 commit 076a21d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions 8th_members/김진아/6주차.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 6주차

## 파이썬에서 프레임 객체 접근해보기
```python
import inspect


def print_frame_info():
frame = inspect.currentframe().f_back
try:
print("Function Name:", frame.f_code.co_name)
print("File Name:", frame.f_code.co_filename)
print("Line No:", frame.f_back.f_lineno)
print("Local Variables:", list(frame.f_locals.keys()))
print("Global Variables:", list(frame.f_globals.keys()))
finally:
del frame


def print_sum(n1, n2):
sum = n1 + n2
print(sum)
print_frame_info()


def print_upper(word):
upper_word = word.upper()
print(upper_word)
print_frame_info()


print_sum(10, 20)
print_upper("Python")
```
<img width="1241" alt="스크린샷 2024-05-12 오후 8 14 24" src="https://github.com/mikaniz/CPython-Guide/assets/92143119/3112a037-a34f-4ab0-8a56-ae7a413af38a">

0 comments on commit 076a21d

Please sign in to comment.