摘要: ~~~ L = ['Michael', 'Sarah', 'Tracy', 'Bob', 'Jack'] 取前3个元素的笨方法 r = [] n = 3 for i in range(n): r.append(L[i]) print(r) 切片 从索引0开始取,直到索引3为止,但不包括索引3。即索引 阅读全文
posted @ 2018-04-30 17:53 畅畅1 阅读(218) 评论(0) 推荐(0) 编辑
摘要: ~~~ 廖雪峰的官方网站 python教材 1~4章 格式控制符语法 print('Hello, %s' % 'world') print('hello, %s, you have %d dollars' % ('mickael', 1000)) print('hello, {0:s}, your 阅读全文
posted @ 2018-04-30 17:52 畅畅1 阅读(294) 评论(0) 推荐(0) 编辑