1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| a=15 if(a>10 and a<100)or(a<-10 and a>-100): print("BINGO")
s="青青子衿,悠悠我心。" print(s[5]) print(s[2:4]) print(s[:4]) print(s[5:]) print(s[8:4])
"{:25}".format(s) "{:1}".format(s) "{:^25}".format(s) "{:>25}".format(s) "{:*^25}".format(s) y=0 z=0 "{0:{1}^25}".format(s,y) "{0:{1}^{2}}".format(s,y,25) "{0:{1}{3}{2}}".format(s,y,25,z)
"{:.2f}".format(3.1415926) "{:>25.3f}".format(3.1415926) "{:.5}".format("全国计算机等级考试") "{:.15}".format("全国计算机等级考试")
|