Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __pycache__/prac1.cpython-311.pyc
Binary file not shown.
Binary file modified __pycache__/prac2.cpython-311.pyc
Binary file not shown.
Binary file modified __pycache__/prac3.cpython-311.pyc
Binary file not shown.
16 changes: 16 additions & 0 deletions prac4_박범준.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# prac4.py

def read_file():
'''
file_name을 입력받고, file_name에 해당하는 파일이 있다면, 해당 파일에 내용을 출력하는 코드를 작성하여라.
단, 만약 파일이 존재하지 않는 경우에는 해당 에러를 예외처리하는 코드를 작성하여라.
'''
file_name = input()
try:
with open(file_name, 'r') as f:
data = f.read()
except FileNotFoundError:
print('There is no file has that file name')

if __name__ == "__main__":
read_file()