|
发表于 2018-4-18 10:11:08
|
显示全部楼层
本帖最后由 风扫地 于 2018-4-18 10:13 编辑
1、input有这个end关键字参数么? 找找函数原型试下,在idle下通过help提供的函数原型信息如下
- >>> help(input)
- 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.
复制代码
2、print函数貌似有,测试代码如下
- temp = input('请输入密码:')
- print( temp , end = ' ' )
- print( temp , end = ' ' )
复制代码
测试结果如下:
3、而print对应的函数说明信息如下,比较一下区别,找出差异,自行解决问题。
- >>> help(print)
- Help on built-in function print in module builtins:
- print(...)
- print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
-
- Prints the values to a stream, or to sys.stdout by default.
- Optional keyword arguments:
- file: a file-like object (stream); defaults to the current sys.stdout.
- sep: string inserted between values, default a space.
- end: string appended after the last value, default a newline.
- flush: whether to forcibly flush the stream.
复制代码 |
|