python学习笔记(二)

永远保持一颗求知的心,不要被已知所束缚。

打印很重要。

A任务:三重单引号避免单双引号的误解

silly_string='''He said, "Aren't can't shouldn't wouldn't"'''

print silly_string

B任务:三重单引号打印超过一行

fred='''How do dinosaurs pay their bills?

With tyrannosaurus checks!'''

print(fred)

C任务:段落格式化打印原理

print(10*'a')

spaces = ' '*25

print('%s 12 Butts Wynd' % spaces)

print()

print('Dear Sir')

print()

print('Regards')

D任务:打印列表

a_list=[1,1,2,3,5,8,13,21,34]

b_list=['which','witch','is','which']

c_list=['why',5,'was',6]

print(a_list)

print(b_list[0])

print(c_list[-1])

你可能感兴趣的:(python学习笔记(二))