初入python

来源:互联网 发布:授权查询系统源码 编辑:程序博客网 时间:2024/05/21 21:47
  python:1.文本输入带引号,其中 ‘ ," , '"相同,输入文本返回文本,返回文本带‘***’单引号;2.通过print方法打印文本,返回文本内容,不会返回引号;3.>>> print("I said,"Don't do it")  该句会报错:SyntaxError: invalid syntax       1.用“/”进行转译      >>>print("I said,\"Don't do it\"")           I said,"Don't do it"    1.     """ 三引号 可以输入多行文本     \n 换行(pdf上面说 python 3.0 有  >>>print("hello","world")---hello world)>>> "hello" "world"'helloworld'>>> print(""" w)ar  """) w)ar>>> print("i said \n \"hello world \"")i said "hello world ">>> print("hello","world")('hello', 'world')    1. %s  是占位符 具体用法 一个%s 表示一个占位符 %10s表示该出应该放入一个10个字符的字符串 one 自由三个字符串前面用空格代替 若为%-5 则是从左开始算>>> "Join %s%s" %("every","man")'Join everyman'>>> "%s  %s  %10s" %("join","every","one")疑问:>>> "\a\b\c\d\e\f\g\h\j\k\l\m\n\o\p"'\x07\x08\\c\\d\\e\x0c\\g\\h\\j\\k\\l\\m\n\\o\\p'>>> print( "rock a by baby,\n\ton the tree top,\t\when the windbows\n\t\t\t the crdel")rock a by baby,    on the tree top,    \when the windbows             the crdel这是什么意思