s = 'alexeweuesir'
print('%'.join(s))
View Code

 

join用法
 

while else 语句 如果遇到了break 就会跳出程序不执行else

# for i in s:
#     print(i)
#     if i == 'e':
#         break
# for i in s:
#     if i == 'e':
#         continue
#     print(i)
View Code

pass是跳过当前循环进入下一个循环

# while True:
#     pass
# else:
#     pass
for i in s:
    if i == 'e':
        pass
    print(i)
else:
    print(666)
View Code

 

posted on 2018-01-25 22:01  仓鼠大人爱吃肉  阅读(146)  评论(0编辑  收藏  举报