# 시간 정보 가져오기

### 코드

```
시간 정보 가져오기
```

***

### 설명

* `시간 정보 가져오기`는 현재 시간을 딕셔너리 형태로 저장해요.
* 딕셔너리는 연, 월, 일, 시, 분, 초의 순서로 시간 정보를 저장해요.

***

### 주의사항

* 출력 형태가 리스트가 아닌 딕셔너리임에 주의해 주세요.

***

### 파이썬 대응 코드

```
from datetime import datetime
now = datetime.now()
```

***

### 예시

{% code title="예시 코드" %}

```
현재_시간 = 시간 정보 가져오기

현재_시간 보여주기
"올해는 " + 현재_시간["연"] + "년이야!" 보여주기
```

{% endcode %}

{% code title="예시 코드의 출력" %}

```
{
	연: 2026
	월: 2
	일: 5
	시: 16
	분: 39
	초: 25
}
올해는 2026년이야!
```

{% endcode %}

***

### 검색 키워드

시간,  시간정보, 현재시간, 날짜, 시각, 딕셔너리


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codebook.horang.it/readme/undefined-7.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
