16ùi?G
1234
s=’’’hello\jack\’’’prints
s=\hello\jack\\prints
??(JXeμ
hello\jack\hello\jack\
??üúòp?±kVúò§Vúòp?±küúò§núòp?±küúòúVúò\
12345678910111213
print’hello\jeapedu.com\!’print’hello\jeapedu.com\!’print\hello’jeapedu.com’!\print\hello’’’jeapedu.com’’’!\print’’’hello’jeapedu.com’!’’’print’’’hello\jeapedu.com\!’’’
print’’’hello\jeapedu.com\!’’’print\hello’jeapedu.com’!\
print\hello’’’jeapedu.com’’’!\print\hello\jeapedu.com\!\
±e???
123
m?oc.??udêe?eapj.wwwprint\hello\jeapedu.com\!\print\hello\jeapedu.com\!\
print’hello’jeapedu.com’!’
??E,??§No?Qoù????n)D??§Python)oìl??mé??1???????úò§XJé????ù????3???§)oì???ù?i?Gü{§XJ??>?ki????i?G?{??\”hello”””jeapedu.com”””!”ù?i?GPython)oìé??o??>??Vúò=@?/hello0?????i?G§???????””jeapedu.com”””!”ò????X?n)??§B?{???\
6.2A?A?i?G6.2.1=?i?G
t>§S¥?éprint”hello”jeapedu.com”!”????§???3uPython)oì3?ni1jc??Vúò?rù?Vúò???i?G—ü??Vúò??§§S??O?′??
34
c?ê???Copyright??
6.3.i?G??–ˉ
?i?Gjck??Vúò§@k?{¢yooùp?3jc>??Vúòc\\t\\?ò,ù′Python?é)oìò??2?????§???3uμPythonuyi?Gpk\\?ò\\ú??>??i?|ü¤???i!i?5??\XJ\\??′Vúò§KPython)oì??n¤i?’”’??§ù??????=?\’\\+i1’???=?i?\
123
print\hello\\\jeapedu.com\\\!\print\hello\\\jeapedu.com\\\!\print’hello\\’jeapedu.com\\’!’
~???=?i?kμ
\\n£??1\\te??L \\\Vúò\\’üúò\\\\????m
6.2.2??i?G
XJi?G????ò′k\\??§????|\\§??`i?Gp??\\?úù????i???w¤=?i??n\@oI?3i?Gc\\ti1r§d???i?G?????i?G§A:′?????<§\\????n¤=?i?\
12
print\:\\temp\\node\\jeapedu.py\
printr\:\\temp\\node\\jeapedu.py\
ww(Jò2x??§??\
c:emp
ode\\jeapedu.py
m?oc.??udêe?eapj.wwwc:\\temp\\node\\jeapedu.py
6.3i?G??–ˉ6.3.1index¢ú
i?G′Pythone??S??.??êaa.§i?Gp??z?i??k??Iò?
±I£ù3i?Gp?? ?§l?–m?g′0....,n?1,lm–??g′?1,?2,....?n(n?i?G???Y)\?dòk?{?±‘?–ˉi?Gp??,?i???\
12
s=\www.jeapedu.com\prints[4]
cjeapedu.comCopyright??35
16ùi?G
6.3.2slice??
??£?????‰?5–ˉi?Gp??fG§?±?L????5??¤–ˉfG§/??0???g?§??ü??§start′???1????? ?§end′???1?????? ?§??–ˉfG???{Xeμ
str_name[start:endμstep]
start′–ˉiG???:§end?a:§step?ú?§??????fGdstart??end-1ù??
i?|¤\
12
s=\www.jeapedu.com\prints[4μ11]
?<(J?μ
jeapedu
start???Kli?G1??i?m??end???§K%@??i?G(??step?
??%@?+1\
????§
step???ê§??l?–m\
1???start??
12
s=\www.jeapedu.com\prints[μ11]
?<(J?μ
www.jeapedu
2???end??
m?oc.??udêe?eapj.www12
s=\www.jeapedu.com\
prints[4μ]
?<(J?μ
jeapedu.com
3startúend??????
12
s=\www.jeapedu.com\prints[μ]
?<(J?μ
www.jeapedu.com
36
c?ê???Copyright??
6.4.i?G$?
4step??1??
12
s=\www.jeapedu.com\prints[μμ2]
?<(J?μ
wwjaeucm
K??§
step?Kê§??lm–?\
1start??§endK§stepK??
12
s=\www.jeapedu.com\prints[10:-12:-1]
?<(J?μ
udepaej
???(J??Xdo2startK§endK§stepK??
12
s=\www.jeapedu.com\prints[-5:-12:-1]
?<(J?μ
udepaej
???(J??Xdo3startúend???§step?-1??
12
m?oc.??udêe?eapj.wwws=\www.jeapedu.com\prints[::-1]
?<(J?μ
moc.udepaej.www
6.4i?G$?6.4.1i?G\\{
ü?i?G‰\\{??′òü?i?G???3??§?é'print?êpü?i?
G?ò??????O\
12
s=\www.jeapedu.com\s1=\pythoneducation\
37
cjeapedu.comCopyright??
16ùi?G
34
prints,s1prints+s1
§S$1(JXe¤?μ
www.jeapedu.compythoneducationwww.jeapedu.compythoneducation
?5?múp?mk???§XJ′?ò???sús1Kk??§XJ′^i?G\\{???ü?i?GK???§ù???±??E???????i?G??\
6.4.2i?G|{
i?G??|{$????uó?i?Gng?\\§T~`2Xeμ
123
s=\www.jeapedu.com\s1=s*3prints1
§S$1(JXe¤?μ
www.jeapedu.comwww.jeapedu.comwww.jeapedu.com
6.4.3i?Gin$?
?±?????i???fG′?3,?i?Gp§XJi?Gp1kù?i???fG§in$?(J?y§?K?b\
1234
s=\www.jeapedu.com\print’j’insprint’jeapedu’insprint’a1’ins
m?oc.??udêe?eapj.www§S$1(JXe¤?μ
True
TrueFalse
6.4.4i?Gnotin$?
?in$??g????—§???ü?i???fG′??3i?Gp\
1234
s=\www.jeapedu.com\print’j’notinsprint’jeapedu’notinsprint’a1’notins
38
c?ê???Copyright??