python知识点(07-08)

python:

循环else:

while true:

         if x>1:

                print()

                 break

else:

       print()

文件循环:

for line in open(‘test.txt’):

       print(line,end=’’)

获得enumerate:

S=’spam‘

for( offset, item) in enumrate(S):

       print(item, ‘appear is’, offset)

备注:

zip函数,使用for循环并行使用多个序列

你可能感兴趣的:(python)