본문 바로가기

hong_mok

검색하기
hong_mok
프로필사진 moki

  • 분류 전체보기 (22)
    • Web (2)
      • CSS (2)
    • Python (4)
    • Baekjoon (5)
    • MacOS (2)
    • Git (4)
    • Algorithm (5)
      • Sort (2)
      • Data Structure (1)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/12   »
일 월 화 수 목 금 토
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 31
Tags
  • sort
  • API
  • Github
  • Markdown
  • Python
  • Flexbox
  • gem
  • web
  • CSS
  • MacOS
  • GIT
  • DataStructure
  • Baekjoon
  • Algorithm
  • JSON
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록API (1)

hong_mok

[Python] requests 모듈 사용하여 api 활용하기

# https://api.agify.io/?name=hong # requests 불러오기 import requests # 나이 예측 api 사용 # 특정 이름을 입력 했을 때, 무작위 나이를 가져와서 name = input("이름을 입력하세요 : ") url = f"https://api.agify.io/?name={name}" response = requests.get(url).json() # ~~의 나이는 ~~살 입니다. 라는 문자 출력 print(f"{name}의 나이는 {response['age']}살 입니다.")

Python 2022. 2. 17. 03:04
Prev 1 Next

Blog is powered by kakao / Designed by Tistory

티스토리툴바