博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Recipe 19.2. Building a List from Any Iterable
阅读量:4982 次
发布时间:2019-06-12

本文共 193 字,大约阅读时间需要 1 分钟。

1 
>>>
 
import
 itertools
2 
>>>
 a
=
[
1
,
2
,
3
]
3 
>>>
 b
=
itertools.islice(a, 
1
2
)
4 
>>>
 
for
 i 
in
 b:
5 
    
print
(i)

Output: 2

 

 

转载于:https://www.cnblogs.com/zhtf2014/archive/2009/10/30/1593349.html

你可能感兴趣的文章
[Angular 8] Implement a Custom Preloading Strategy with Angular
查看>>
[Dart] Understand Classes and Inheritance in Dart
查看>>
[Angular] Using Pipe for function memoization
查看>>
[Angular 8] Custom Route Preloading with ngx-quicklink and Angular
查看>>
[Angular 8] Calculate and Measure Performance budgets with the Angular CLI
查看>>
[CSS] Conditionally Assign Style to a Parent Element with Focus-Within Pseudo-class
查看>>
[React + GraphQL] Use useLazyQuery to manually execute a query with Apollo React Hooks
查看>>
[Functional Programming] Rewrite a reducer with functional state ADT
查看>>
[Dart] Manipulate Lists/Arrays in Dart
查看>>
[AngularJS] Extend Controller
查看>>
[CSS] The :empty Pseudo Selector Gotchas
查看>>
[Cypress] install, configure, and script Cypress for JavaScript web applications -- part5
查看>>
[Flutter] Layout
查看>>
[RxJS] Convert a Node.js style callback to Observable: bindNodeCallback
查看>>
[NgRx] Setting up NgRx Router Store and the Time-Travelling Debugger
查看>>
[ARIA] Accessible modal dialogs
查看>>
[Dart] Dynamic variable in Dart
查看>>
[ARIA] Accessible animations with reduced motion
查看>>
[ARIA] What is Accessible Name Calculation?
查看>>
[NgRx] NgRx Runtime Checks
查看>>