1.讓你的腳本多打印一行
print ("Hello World.\n"
換行.png
2.讓你的腳本只打印一行
print ("Hello World.",end = "")
print ("Hello yyc.",end = "")
一行.png
3.符號(hào)
#(octothorpe)井號(hào)
/(slash)斜杠
*(asterisk)星號(hào)
\(back-slash)反斜杠
\\(double back-slash)雙反斜杠
4.格式化字符串是啥尔邓?(format string)
%s,%d
①%r
和%s
的區(qū)別概漱?
-
%r
----"不管什么都打印出來" -
%s
---字符串
%s%r區(qū)別.png
5.
- inches英寸,1 : 2.54cm
- bound磅替梨,1 : 0.97斤
6.兩種為格式化字符賦值的方式
- 使用時(shí)删窒,
%
后面直接跟個(gè)字符串,別忘記引號(hào)喔~ - 先聲明個(gè)變量葡秒,然后使用這個(gè)變量
可以在%后直接整個(gè)字符串加引號(hào).png
7.
-
raw_input()
---python2 -
input()
---python3
raw_input().png