首页 > 编程语言 > 详细

python出输出字符串方式:

时间:2015-01-31 19:12:08      阅读:210      评论:0      收藏:0      [点我收藏+]

python出输出字符串方式:

>>> who=‘knights‘

>>> what=‘NI‘

>>> print (‘we are the‘,who,‘wha say‘,what,what,what,what)

we are the knights wha say NI NI NI NI

>>> print (‘we are the %s who say %s‘% (who,(what+‘ ‘)*4))

we are the knights who say NI NI NI NI

>>>

python数字循环

>>> for item in [0,1,2]:

 print (item)

0

1

2

>>> for item in range(3):

 print (item)

0

1

2

>>>

>>> for item in range(3):

 print (item)

0

1

2

>>> foo=‘abc‘

>>> for i in range(len(foo)):

 print (foo[i],‘%d‘% i)

a 0

b 1

c 2

>>>

python出输出字符串方式:

原文:http://www.cnblogs.com/szy123618/p/4264453.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!