pthyon中原始数据raw data和原始字符串r

<span style="font-size:14px;"></pre><pre name="code" class="python">Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
</span>
<span style="font-size:14px;">>>> str1 = raw_input("input str:")
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    str1 = raw_input("input str:")
NameError: name 'raw_input' is not defined
>>> str1 = input("input str:")
input str:i love you
>>> print str1
SyntaxError: Missing parentheses in call to 'print'
>>> print(str1)
i love you</span>

raw_input表示输入原始数据

在字符串前面加“r”表示字符串,原始字符串不会把反斜线当做特殊字符,原始字符串每个字符都会和书写方式一致

<span style="font-size:14px;">#在python3.0以后的版本中,raw_input和input合体了,取消raw_input,并用input代替,所以现在的版本input接收的是字符串</span>

 #当M大于有效位的时候,表达式右对齐,当M小于有效位的时候,python编译器会正常输出有效数据



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值