码迷,mamicode.com
首页 > 编程语言 > 详细

python出输出字符串方式:

时间:2015-01-31 19:13:47      阅读:192      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!