본문 바로가기

솔루션모음/파워 유저를 위한 파이썬 express 이론14

[파워 유저를 위한 파이썬express] 10장 이론 연습문제 Exercise 솔루션 답지 1. IOError 예외 발생 >>> f = open("test.txt","r") IOError: [Errno 2] No such file or directory: 'test.cat' 3. import os.path from os import path print (str(path.exists('input.txt'))) 5. readline() 7. write() 9. file1 = open("c:\\temp\\scores.txt", "r") 11. 텍스트 파일에서는 모든 정보가 문자열로 변환되어서 파일에 기록되었다. 반면에 이진 파일(binary file)은 데이터가 직접 저장되어 있는 파일이다. 13. 파일 포인터는 파일에서 입출력이 이루어지는 위치를 나타낸다. 처음에는 0이다. 15. 예외가 일어나도.. 2023. 1. 9.
[파워 유저를 위한 파이썬express] 9장 이론 연습문제 Exercise 솔루션 답지 1. Place 3. frame.bind("", callback) 5. move() 메소드를 사용하여서 캔버스를 움직인다. 7. Button(window, text="Click Me", command=lambda: clicked()) 2023. 1. 9.
[파워 유저를 위한 파이썬express] 8장 이론 연습문제 Exercise 솔루션 답지 1. class MyClass: self.data = 12 p = MyClass() print(p.data) 3. Good Morning 5. class MyClass: def __init__(self, r): self.__radius = r a = MyClass(10) print(a.__radius) # private 필드는 접근할 수 없다. 2023. 1. 9.
[파워 유저를 위한 파이썬express] 7장 이론 연습문제 Exercise 솔루션 답지 1. 리스트나 딕셔너리를 사용한다. 세트는 중복이 허용이 안되므로 좋지 않다. 3. 500 (300, 400) 5. mytuple = (10, 20, 30, 40) a, b, c, d = mytuple 7. © 9. (a), (b) 11. (a), (c ) 13. {'Milk', 'Orange', 'Bread', 'Butter'} 15. True True 17. (a), (b) 19. Hel World 2023. 1. 9.