Python

places=["paris","lendon","shanghai"];
for place in places:
    print(place)
 #   we use indentation rather than brackets to present domain
for place in places:
    print(place.title()+", this is the most beautiful place i hava seen")
    print("i am waiting for the the next time to see you:"+place.title()+".\n"

Python中表示域,不用括号,而是缩进!!!!,因此上述代码中两个print均在for 语句的作用域中

单行注释用#

再次强调,缩进在Python中不可以乱用。不可以平白无故的使用缩进,使用缩进时一定要注意从属关系

posted @ 2018-08-10 22:17  少年π  阅读(152)  评论(0编辑  收藏  举报