python与perl的差异之点号

(1)在Perl中将两个字符串链接起来可以使用点号"."

(2)而在Python中同样的功能是使用加号"+"

(3)Python中的点号"."是一个面向对象里的对象的属性(或方法)。

(4)相应的功能在Perl是箭头表示"->"

 

举例:

(1)Perl中 "this is a string"." and another string" 结果将是 字符串: "this is a string and another string"。

(2)Pyton中 "this is a string"." and another string" 将会提示错误:

  AttributeError: 'str' object has no attribute " and another string"

posted @ 2017-05-26 13:50  mandola  阅读(937)  评论(0编辑  收藏  举报