/\/\/\/\/\

来源:互联网 发布:uc2监控软件账号注册 编辑:程序博客网 时间:2024/05/16 17:27


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

        斜杠最典型的应用: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 hihithere>>>>>> name='noxi'>>> action='love'>>> animal='dog'>>> hiahia=name+'\\'+action+'\\'+animal>>> print hiahianoxi\love\dog>>>>>> hiahia'noxi\\love\\dog'>>> 



原创粉丝点击