Python基础-输入输出
来源:互联网 发布:淘宝死多少人 编辑:程序博客网 时间:2024/06/05 06:57
Python的输出
输出比较简单,直接向屏幕上输出指定文字,例如‘hello world’,使用如下代码即可
>>> print('hello world')
当然也可以输出多个字符串使用‘,’逗号隔开,就可以连成一串输出。
>>>print('hello world', 'hello python')hello world hello python
可以看到python输出过程中把逗号替换成了空格。
同理可以输出整数、浮点数等等
Python的输入
假如我们想要给某个变量进行输入,该如何进行呢?
通过input()可以让用户输入字符串并存储在一个变量中。例如:
>>> print('input:')>>> string = input()>>> print(string)input:hi python #输入的字符串hi python
另外要注意的是python的注释使用#开头,并且严格执行缩进!按照常用的缩进格式一般都是4个空格。python和C++等一些语言一样是大小写敏感的!
阅读全文
1 0
- python基础学习-输入输出
- Python基础-输入输出
- python 基础学习1---输入输出
- Python基础概念_9_输入输出
- Python基础入门之输入输出
- Python基础(九)——输入输出
- python:NumPy基础(3),文件输入输出
- python输入输出
- Python输入输出
- python输入输出
- Python输入输出
- python输入输出
- Python 输入输出
- Python输入输出
- python 输入输出
- Python输入输出
- python 输入输出
- python输入输出
- LowRecyclerView:一个简单强大的RecyclerView工具类
- liunx中安装mysql数据库
- Tomcat源码分析之二_ 一次完整请求
- 像素翻转
- [Unity&C#&接口]通过接口调用不同类型 物体 的继承了接口的组件
- Python基础-输入输出
- 这是我的第一篇博客
- 性能分析工具TraceView
- 细说微服务架构的优势与不足这点事
- ConcurrentHashMap
- caffe基础知识简介
- 2017计蒜之道初赛第六场-微软大楼设计方案(简单)
- 设计模式之中介者模式
- 数据预处理总结