What's the difference between input() and raw_input()?
The input() function will try to convert things you enter as if they were Python code, but it has security problems so you should avoid it.
1
purebluesong 2017-01-15 15:53:03 +08:00
在 python2 中 input 会把读到的 python 代码跑起来
|
2
Izual_Yang 2017-01-15 15:57:31 +08:00 via Android
一个是输入纯字符串所以是 raw ,一个是输入表达式所以有安全隐患。另外笨办法学 python 应该有中文翻译版本的吧
|
3
lanlanlan 2017-01-15 16:04:52 +08:00 1
input 会假设用户输入的是合法的 Python 表达式 而 raw_input 会把输入的内容当作原始数据 一般情况下多用 raw_input
|
4
chuanqirenwu 2017-01-15 16:25:29 +08:00 via iPhone
As if 只要
|
5
congeec 2017-01-15 16:48:58 +08:00 via iPad
eval()
|
6
redhatping 2017-01-15 17:05:21 +08:00
as if 连词 = like (口语习惯)
|
7
thekll 2017-01-15 17:06:19 +08:00
'like/as if/as though' is used to say how somebody or something looks/sounds/feels.
'as if' and 'as though' are more formal than 'like'. After 'as if'(or 'as though'), we sometimes use the past when we are talking about the present. for example: 'as if they were Python code' The meaning is not past in this sentence, We use the past('were') because the things you enter for the function input() is not really Python code, it will be converted and run. |
8
arischow 2017-01-15 17:14:20 +08:00 via iPhone 1
这个有翻译,看不懂可以先去看一眼翻译版本。
|
9
shakespark 2017-01-15 18:06:02 +08:00
虚拟语气
|
10
zhidian 2017-01-15 18:11:16 +08:00
as if 是“就像”吧。
|
11
zingl 2017-01-15 20:23:33 +08:00
中学英语内容吧
|
12
N0stalgia 2017-01-15 21:59:15 +08:00
生硬的翻译下,就好像 Python 代码一样。
|
13
msg7086 2017-01-16 04:00:24 +08:00
as 表示类比。
if 表示假设。 连在一起:「就好像」。 |
14
4ever911 2017-01-16 10:06:02 +08:00
假如,如果
|
15
20150517 2017-01-16 17:22:23 +08:00 via iPhone
as if 就好像 我是这么理解的
|