본문 바로가기
728x90
반응형
SMALL

전체 글380

python) Downloading and Saving Content from the Web with Python from urllib import request target = request.urlopen("http url") output = target.read() print(output) file = open("output.png", "wb") file.write(output) file.close() 1. **from urllib import request**: Imports the `request` submodule from Python's `urllib` module. `urllib` is a package that contains several modules for working with URLs, and `request` is specifically used for opening and reading U.. 2024. 11. 20.
python) __name__ method (Calculating Circumference and Area of a Circle in Python) A_0 PI = 3.141592 def number_input(): output = input("숫자 입력 : ") return float(output) def get_circumference(radius): return 2 * PI * radius def get_circle_area(radius): return PI * radius * radius print("get_circumference(10) : ", get_circumference(10)) print("get_circle_area(10) : ", get_circle_area(10)) 1. **PI = 3.141592**: This line defines a constant `PI` with the approximate value of pi (π.. 2024. 11. 19.
python) how to use the module package in python? A_0 PI = 3.141592 def number_input(): output = input("숫자 입력 : ") return float(output) def get_circumference(radius): return 2 * PI * radius def get_circle_area(radius): return PI * radius * radius 1. **PI = 3.141592**: Sets a constant named `PI` to an approximation of π, a mathematical constant that represents the ratio of a circle's circumference to its diameter. 2. **def number_input():** Defi.. 2024. 11. 18.
python) how to make the module to check about Entry point A_0 PI = 3.141592 def number_input(): output = input("숫자 입력 : ") return float(output) def get_circumference(radius): return 2 * PI * radius def get_circle_area(radius): return PI * radius * radius if __name__ == '__module_C_1__': print("get_circumference(10) : ", get_circumference(10)) print("get_circle_area(10) : ", get_circle_area(10)) 1. **PI = 3.141592**: Defines a constant `PI` that holds t.. 2024. 11. 17.
728x90
반응형
LIST