1.print()与input()
hello world必备-》print函数
print():
作用:
打印函数,打印数据到屏幕中
参数列表:
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
参数解释:
value,...,代表可以有多个要打印的数据,如print("a","b","c")
sep代表打印出的各个数据之间的参数
end代表打印结束字符,如\n代表打印完换行,\t代表打印完缩进到下一位置
file代表输出流,sys.stdout代表标准输出流,sys.stderr代表标准错误流
flush代表是否立即刷新缓冲区
用法:
print("hello world!")
print(1,2,3,sep='\t')
print('a','b','c',sep='#')
print(1,end='\t')
print(2)
输出结果:
hello world!
1 2 3
a#b#c
1 2
input():
作用:
输入函数,获取用户输入
参数列表:
input("输入提示信息")
用法:
name=input("你的名字:")
age=input("你的年龄:")
输出结果:

如果要使用非明文可见模式,使用getpass模块下的getpass:
(此模块在pycharm中无法正常使用))
用法:
import getpass
pwd=getpass.getpass("请输入密码:")

1.print()与input()的更多相关文章
- Learning Python 002 print() 和 input()
Python print() 和 input() print()函数 print()函数可以向终端中输入指定的内容. 输出当个字符串 .py文件中,输入下面的代码,并保存: print('hello ...
- python3.5在print和input上的几个变化
1. 在python3.5中使用print,打印内容必须用括号()括起来.python2.7中可以不用括号,如果你加了括号,代码在python2.7中也是可以正常运行的. python3.5 exam ...
- python中print和input的底层实现
print print的底层通过sys.stdout.write() 实现 import sys print('hello') print('world') print(520) sys.stdout ...
- Python中的print、input函数以及Python中交换两个变量解析
一.Python中的值交换操作 首先明确一点点,Python中的一切都是面向对象的,可以理解为Python的中一切都是对象. 我们知道Java也是面向对象的语言,但是在Java中定义一个值变量如下: ...
- 浅析 python中的 print 和 input 的底层区别!!!
近期的项目中 涉及到相关知识 就来总结一下 ! 先看源码: def print(self, *args, sep=' ', end='\n', file=None): # known special ...
- [Python] Print input and output in table
Print the input and output in a table using prettyTable. from prettytable import PrettyTable import ...
- 2.1 Python3基础-内置函数(print&input)
>>返回主目录 源代码 # 内置函数:输入/输出 name = 'Portos' age = 18 sex = 'man' score = 99.5 print('Hello World! ...
- Python input 使用
Python 3.0 中使用"input" , Python 2.0 中使用"raw_input"Python 3.5: #!C:\Program Files\ ...
- python学习03——设计,与input有关
笨办法学python第36节,我写的代码如下: from sys import exit def rule(): print "Congratulations! You made the r ...
随机推荐
- Future接口和Callable接口以及FeatureTask详解
类继承关系 Callable接口 @FunctionalInterface public interface Callable<V> { V call() throws Exception ...
- manjaro 添加当前用户到kvm
原贴 https://askubuntu.com/questions/1050621/kvm-is-required-to-run-this-avd Check the ownership of /d ...
- 理解Golang包导入
Golang使用包(package)这种语法元素来组织源码,所有语法可见性均定义在package这个级别,与Java .python等语言相比,这算不上什么创新,但与C传统的include相比,则是显 ...
- WPF ViewBox中的TextBlock自适应
想让 TextBlock即换行又能自动根据内容进行缩放,说到自动缩放,当然是ViewBox控件了,而TextBlock有TextWrapping属性控制换行, 所以在ViewBox中套用一个TextB ...
- java web 手动部署项目步骤
java Web 手动部署项目步骤 1 在tomcat下面的webapps下面建立需要部署的文件夹(eg:demo);2 在demo下建立 WEB-INF WETA-INF src 文件夹;3 在sr ...
- elasticSearch6源码分析(3)cluster模块
1. cluser概述 One of the main roles of the master is to decide which shards to allocate to which nodes ...
- JVM学习记录-线程安全与锁优化(一)
前言 线程:程序流执行的最小单元.线程是比进程更轻量级的调度执行单位,线程的引入,可以把一个进程的资源分配和执行调度分开,各个线程既可以共享进程资源(内存地址.文件I/O等),又可以独立调度(线程是C ...
- c# LINQ用法
一.什么是LINQ LINQ(读音link)代表语言集成查询(Language Integrated Query),是.NEt框架的扩展,它允许我们用SQL查询数据库的方式来查询数据的集合,使用它,你 ...
- Windows安装Apache2.4和PHP5.6
VC11 下载安装http://www.microsoft.com/en-us/download/details.aspx?id=30679 ================= PHP(5.6) VC ...
- MySQL 学习笔记 二
Ø function 函数 函数的作用比较大,一般多用在select查询语句和where条件语句之后.按照函数返回的结果, 可以分为:多行函数和单行函数:所谓的单行函数就是将每条数据进行独立的计算,然 ...