ubuntu桌面版+geany--->python3开发
python基本数据类型: 字符串(str), 数字(整数:int, 浮点数:float),
#####字符串 函数 name="i love python AAAdd a " print(name.title())# 标题栏:首字母大写 I Love Python Aaadd A print(name.lower())#全小写 i love python aaadd a print(name.upper())#全大写 I LOVE PYTHON AAADD A print(name.rstrip())#去尾空格: print(name.strip())#去两头空格,中间不变 print("color:\n\tred\n\tblack\n\tblue")#换行符号,制表符 ######数字 + 字符串 age=23 ''' mess="happy"+age+"thd birthday" print(mess) #error : Can't convert 'int' object to str ''' mess="happy "+str(age)+"thd birthday" print(mess) #####浮点数:加减乘除 python2.7 ''' >>> 0.1+0.2 0.30000000000000004 >>> 1/2 0 >>> 0.3+0.1 0.4 >>> 1.0/2 0.5 >>> 3/2 1 >>> 3.0/3 1.0 >>> 1/3.0 0.3333333333333333''' ######浮点数: 加减乘除 python3.5 ''' >>> 0.1+0.2 0.30000000000000004 >>> 0.3+0.1 0.4 >>> 1/2 0.5 >>> 1/3 0.3333333333333333 >>> 1.0/3 0.3333333333333333 ''' ###python编程理想: python之禅 ''' >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! >>> '''