Python3基础 input 输入浮点数,整数,字符串
- Python : 3.7.0
- OS : Ubuntu 18.04.1 LTS
- IDE : PyCharm 2018.2.4
- Conda : 4.5.11
- typesetting : Markdown
code
"""
@Author : 行初心
@Date : 18-9-24
@Blog : www.cnblogs.com/xingchuxin
@Gitee : gitee.com/zhichengjiu
"""
def main():
my_float = float(input('请输入一个浮点数:'))
my_int = int(input('请输入一个整数:'))
my_str = input('请输入一个字符串:')
if __name__ == '__main__':
main()
result
/home/coder/anaconda3/envs/py37/bin/python /home/coder/PycharmProjects/basic/demo.py
请输入一个浮点数:1.2
请输入一个整数:25
请输入一个字符串:hello
Process finished with exit code 0
more knowledge
Help on built-in function input in module builtins:
input(prompt=None, /)
Read a string from standard input. The trailing newline is stripped.
The prompt string, if given, is printed to standard output without a
trailing newline before reading input.
If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
On *nix systems, readline is used if available.
resource
- [文档] docs.python.org/3
- [规范] www.python.org/dev/peps/pep-0008
- [规范] zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules
- [源码] www.python.org/downloads/source
- [ PEP ] www.python.org/dev/peps
- [平台] www.cnblogs.com
- [平台] gitee.com
Python具有开源、跨平台、解释型、交互式等特性,值得学习。
Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。
代码的书写要遵守规范,这样有助于沟通和理解。
每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。
Python3基础 input 输入浮点数,整数,字符串的更多相关文章
- Python3基础数据类型(数字、字符串、元组、列表、集合、字典)
笔记参考了菜鸟教程 Python 中的变量不需要声明,赋值才创建.赋值给变量的是什么类型变量就是什么类型 多个变量赋值 1 a, b, c = 1, 2, "runoob" 标准数 ...
- Python3基础 str while+iter+next 字符串的遍历
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str capitalize 返回新字符串,第一个字母大写
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础02(列表和字符串处理)
str = 'Runoob'# 输出字符串print(str) # 输出第一个到倒数第二个的所有字符print(str[0:-1]) # 输出字符串第一个字符print(str[0]) # 输出从第三 ...
- Python3基础 列表乘一个整数 扩增列表
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- Python3基础 len函数 获得一个字符串的字符个数
镇场诗:---大梦谁觉,水月中建博客.百千磨难,才知世事无常.---今持佛语,技术无量愿学.愿尽所学,铸一良心博客.------------------------------------------ ...
- Python3基础 str partition 以参数字符串切分字符串,只切分为三部分
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str count 获得子字符串出现的次数
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- Python3基础 str *运算 重复拼接字符串
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
随机推荐
- numpy中np.nan(pandas中NAN)
转自:http://blog.csdn.net/xiaodongxiexie/article/details/54352889 在处理数据时遇到NAN值的几率还是比较大的,有的时候需要对数据值是否为n ...
- Linux连接字符串
https://blog.csdn.net/ysdaniel/article/details/6920866 或者 '/g' in.txt>out.txt
- git push 文件过大时出错,fatal: The remote end hung up unexpectedly
可以修改配置文件: 1 使用命令:git config http.postBuffer = 524288000 2修改git文件夹中的config文件,加入如下一段: [http] postBuffe ...
- python2.7+pyqt4实现记事本基本功能
记事本程序: # coding:utf-8 import sys from PyQt4.QtGui import QMainWindow from PyQt4.QtGui import QApplic ...
- mysql 内置功能 存储过程 创建无参存储过程
操作哪个数据库,就把存储过程建到那个数据库 例如 现在use db2; 应该把存储过程 建立到db2数据库里 创建无参存储过程 delimiter // # 设置mysql结束符合为// create ...
- C#基础笔记(第十一天)
1.复习字符串(1)字符串的不可变性(2)字符串的方法:1)Split() 分割 把字符串中不想要的内容分割掉 返回一个字符串类型的数组 可以添加StringSplitOption.RemoveEmp ...
- gradle build scan
1:gradle build scan 用于视图审查 构建步骤如下 https://guides.gradle.org/creating-build-scans/?_ga=2.80362963.59 ...
- django 中的render和render_to_response()和locals()
1. django中的render context在Django里表现为 Context 类,在 django.template 模块里. 它的构造函数带有一个可选的参数: 一个字典映射变量和它们的值 ...
- testng入门教程9 TestNG依赖测试
有时候,你可能需要在一个特定的顺序调用方法在测试案例,或你想分享一些数据和方法之间的状态.TestNG支持这种依赖测试方法之间的显式依赖它支持声明. TestNG允许指定依赖,无论与否: 使用属性de ...
- Integer类之equals与hashCode
一.源码. 1.equals源码.可以看出,比较的是两者的类型相同且内容相同.即是否有相等的int类型的value值. ######################################## ...