摘要: 7.1 创建多行字符串的方式: 01 prompt="if you tell me who you are, we can personalize the message you see." 02 prompt+="what is your first name? "; 03 04 name=input(prompt); 05 print(... 阅读全文
posted @ 2019-06-09 20:00 Franzqing 阅读(173) 评论(0) 推荐(0)
摘要: 函数简单的定义: 01 def greet_user(username): 02 """显示简单的问候语""" 03 print("Hello, " + username.title() + "!") 04 greet_u... 阅读全文
posted @ 2019-06-09 20:00 Franzqing 阅读(109) 评论(0) 推荐(0)
摘要: 6.1 使用字典 在Python中, 字典 是一系列键—值对 。 每个键 都与一个值相关联, 你可以使用键来访问与之相关联的值。 与键相关联的值可以是数字、 字符串、 列表乃至字典。 事实上, 可将任何Python对象用作字典中的值。 在Python中, 字典用放在花括号{} 中的一系列键—值对表示 添加键-值对: 01 alien_0 = {'color': 'gre... 阅读全文
posted @ 2019-06-09 19:59 Franzqing 阅读(155) 评论(0) 推荐(0)