exercise 10
来源:互联网 发布:联通客服上门调网络 编辑:程序博客网 时间:2024/04/28 01:22
print "I am 6'2\" tall." \" to mean" in case mistake with ending
print 'I am 6\'2" tall.'tabby_cat="\t I'm tabbed in." persian_cat="I'm split\non a line."backslash_cat="I'm \\ a \\ cat."fat_cat = """I'll do a list:\t* Cat food\t* Fishies\t* Catnip\n\t* Grass"""print tabby_catprint persian_catprint backslash_catprint fat_cat
Here's a tiny piece of fun code to try out:
while True: for i in ["/","-","|","\\","|"]: print "%s\r" % i,
解释:\r表示回到行首 所以循环输出 | // | - / 上面倒着顺序?????
转义字符和格式化字符串放一起创建更加复杂的格式。persian_cat = "I'm spliton\v %s line." % "a"还记得%r吗?%r搭配单引号和双引号转义字符,并且打印出来。比较%r和%s,%r打印你要写到文件里的样子,%s打印你想看到的样子。persian_cat = "I\'m spliton \"%s\" %r." % ("a", "line")输出:I'm spliton "a" 'line'.注意line有个单引号,表示你要写入程序的是个字符串。
转义字符
\(在行尾) 续行,表示不换行\\ 反斜杠\' 单引号\" 双引号\a 响铃\b 退格,表示删除前面一个字符\t 水平制表符\v 垂直制表符,表示换行,然后从\v的地方开始输出。\n 换行\f 换页\r 回车 回到行首
Escape What 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)\rCarriage Return (CR)\tHorizontal Tab (TAB)\uxxxxCharacter with 16-bit hex value xxxx (u'' string only)\UxxxxxxxxCharacter with 32-bit hex value xxxxxxxx (u'' string only)\vASCII vertical tab (VT)\oooCharacter with octal value ooo\xhhCharacter with hex value hh
0 0
- exercise 10
- ? P20 Exercise 1-10
- Python Exercise #10
- Exercise 10: 那是什么?
- linux exercise 10
- linux exercise 10
- Exercise
- exercise
- Exercise
- exercise
- C程序设计语言 Exercise 2-10
- Accelerated C++ Exercise 10-0
- LeetCode Exercise 10: Merge Intervals
- JOS实验——Exercise 10
- Exercise: Use Python in ArcGIS Desktop 10
- Accelerated C++ Exercise 5-10(回文数)
- Accelerated C++ Exercise 10-2,3
- Exercise(10):N个2015(有待解答)
- Qt发布exe
- linux实训(day_1)
- 蓝桥杯校内选拔第一题
- stm32中断优先级分组
- javaweb 文件上传(fileupload) 下载
- exercise 10
- Codeforces GYM 100803F
- Uncaught TypeError: window.showModalDialog is not a function 谷歌
- BZOJ 3781 莫队算法
- 阿里云Maven中央仓库
- 蓝桥杯校内选拔第二题
- 其他博客进行ing
- 默认的命令提示符 λ 改成 $
- 关于前端跨域那些事(nginx 反向代理 跨域)