/\/\/\/\/\


斜杠和反斜杠 傻傻分不清楚:

        斜杠最典型的应用:URL

        反斜杠最典型的应用:转义字符


以下为插播:

1.URL语法的通用格式:

<scheme>://<user>:<password>@<host>:<port>/<path>;<params>?<query>#<flag>

当然几乎没有哪个URL中包含了以上所有组件。。。

2.转义字符请跳:http://blog.csdn.net/lqhbupt/article/details/19346347

EscapeWhat it does.含义 
\\Backslash ()反斜杠
\'Single-quote (')单引号
\"Double-quote (")双引号
\aASCII bell (BEL)响铃符
\bASCII backspace (BS)退格符
\fASCII formfeed (FF)进纸符
\nASCII linefeed (LF)换行符
\N{name}Character named name in the Unicode database (Unicode only)Unicode数据库中的字符名;name就是它的名字
\r ASCIICarriage Return (CR)回车符
\t ASCIIHorizontal Tab (TAB)水平制表符
\uxxxxCharacter with 16-bit hex value xxxx (Unicode only)值为16位十六进制xxxx的字符
\UxxxxxxxxCharacter with 32-bit hex value xxxxxxxx (Unicode only)值为32位十六进制xxxx的字符
\vASCII vertical tab (VT)垂直制表符
\oooCharacter with octal value ooo值为八进制ooo的字符
\xhhCharacter with hex value hh值为十六进制数hh的字符


举个小栗子,python中反斜杠的使用:

>>> hi = '''hi
... there'''
>>> hi
'hi\nthere'
>>> hi = 'hi\nthere'
>>> hi
'hi\nthere'
>>> print hi
hi
there
>>>
>>> name='noxi'
>>> action='love'
>>> animal='dog'
>>> hiahia=name+'\\'+action+'\\'+animal
>>> print hiahia
noxi\love\dog
>>>
>>> hiahia
'noxi\\love\\dog'
>>> 



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值