# 14.输入输出格式化

## 1. 标准输入 (`input`)

`input` 函数接收命令行输入

![](https://pic.existorlive.cn/202112240034845.png)

## 2. 标准输出 (`print`)

`print` 函数用于将字符串输出到命令行中

### 2.1 str()/repr()

* `str()` ： 函数返回一个用户易读的表达形式。
* `repr()`: 产生一个解释器易读的表达形式

### 2.2 rjust()/ljust()/center()

用**空格**将字符串补全至目标长度；

* rjust(num) ： 右对齐
* ljust(num) ： 左对齐
* center(num) ： 局中

![](https://pic.existorlive.cn/202112240100826.png)

### 2.3 zfill()

在数字左边填充 0

![](https://pic.existorlive.cn/202112240102695.png)


---

# 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://gitbook.existorlive.cn/kai-fa-yu-yan-xue-xi/python/14.-shu-ru-shu-chu-ge-shi-hua.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.
