1.RandSeq

#coding:utf-8
#!/usr/bin/env python
'randSeq.py -- 迭代'

#从random模块里仅仅导入choice方法
from random import choice	

class RandSeq(object):
	def __init__(self,seq):
		self.data = seq;
		
	def __iter__(self):
		return self;
	
	def next(self):
		return choice(self.data)
		
if __name__ == '__main__':
	for eachItem in RandSeq(('rock','paper','scisc')):
		print eachItem




	

 

相关文章:

  • 2021-11-16
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-02-02
  • 2022-12-23
猜你喜欢
  • 2021-12-15
  • 2021-08-20
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案