摘要: 1、字符与字符串的赋值brian = "Always look on the bright side of life!" caesar = "Graham"praline = "John"viking = "Teresa" fifth_letter = "MONTY"[4]print fifth_letter# 输出的是Y,从0开始计数2、字符串的一些函数以及数值转字符串pi = 3.14print str(pi)#数值转字符串 ministry = "The Ministry of 阅读全文
posted @ 2013-09-26 11:26 hz_howe 阅读(135) 评论(0) 推荐(0)
摘要: 一. 变量名直接声明:my_int = 7my_float = 1.23my_bool = True二.空格def spam(): eggs = 12 return eggs print spam()第二行、第三行必须有前置空格,否则会产生错误三.注释# What's this mysterious variable for? 单行注释"""I'm a lumberjack and I'm okayI sleep all night and I work all day! 多行注释 """四.数学操作# +co 阅读全文
posted @ 2013-09-22 10:01 hz_howe 阅读(277) 评论(0) 推荐(0)