コード例 #1
0
ファイル: generatordriver.py プロジェクト: yangjiao2/Python
from goody import irange
from generator import sequence, transform, count, chunk_sum, flatten

for i in sequence('abcd', 'ef', 'ghij'):
    print(i, end='')
print()


def upper(x):
    return x.upper()


for i in transform('abCdeFg', upper):
    print(i, end='')
print()


def is_upper(x):
    return x == x.upper()


for i in count('aBcDEfGhijK', is_upper):
    print(i, end=' ')
print()

for i in chunk_sum(irange(1, 20), 5):
    print(i, end=' ')

for i in flatten([1, 2, [3, 4, (5, 6, 7, {'abc': 1, 'xyz': 2}), 8, 9], 10]):
    print(i, end=' ')
コード例 #2
0
ファイル: generatordriver.py プロジェクト: yangjiao2/Python
from goody import irange
from generator import sequence, transform, count, chunk_sum, flatten


for i in sequence('abcd','ef','ghij'):
    print(i,end='')
print()


def upper(x):
    return x.upper()
    
for i in transform('abCdeFg',upper):
    print(i,end='')
print()
    
def is_upper(x):
    return x == x.upper()

for i in count('aBcDEfGhijK',is_upper):
    print(i,end=' ')
print()


for i in chunk_sum(irange(1,20),5):
    print(i,end=' ')

for i in flatten([1,2,[3,4,(5,6,7,{'abc':1,'xyz':2}),8,9],10]):
    print(i,end=' ')
コード例 #3
0
for i in n_with_pad('abcdefg',10,'?'):
    print(i,end=' ')
print()

for i in n_with_pad('abcdefg',10):
    print(i,end=' ')
print()

for i in n_with_pad(lets('abcdefg'),10):
    print(i,end=' ')
print()



for i in sequence('abcde','fg','hijk'):
    print(i,end=' ')
print()

for i in sequence(lets('abcde'),lets('fg'),lets('hijk')):
    print(i,end=' ')
print()



for i in alternate('abcde','fg','hijk'):
    print(i,end=' ')
print()

for i in alternate(lets('abcde'),lets('fg'),lets('hijk')):
    print(i,end=' ')
コード例 #4
0
print()

for i in n_with_pad("abcdefg", 10, "?"):
    print(i, end=" ")
print()

for i in n_with_pad("abcdefg", 10):
    print(i, end=" ")
print()

for i in n_with_pad(lets("abcdefg"), 10):
    print(i, end=" ")
print()


for i in sequence("abcde", "fg", "hijk"):
    print(i, end=" ")
print()

for i in sequence(lets("abcde"), lets("fg"), lets("hijk")):
    print(i, end=" ")
print()


for i in alternate("abcde", "fg", "hijk"):
    print(i, end=" ")
print()

for i in alternate(lets("abcde"), lets("fg"), lets("hijk")):
    print(i, end=" ")
print()
コード例 #5
0
    print(i, end=' ')
print()

for i in n_with_pad('abcdefg', 10, '?'):
    print(i, end=' ')
print()

for i in n_with_pad('abcdefg', 10):
    print(i, end=' ')
print()

for i in n_with_pad(lets('abcdefg'), 10):
    print(i, end=' ')
print()

for i in sequence('abcde', 'fg', 'hijk'):
    print(i, end=' ')
print()

for i in sequence(lets('abcde'), lets('fg'), lets('hijk')):
    print(i, end=' ')
print()

for i in alternate('abcde', 'fg', 'hijk'):
    print(i, end=' ')
print()

for i in alternate(lets('abcde'), lets('fg'), lets('hijk')):
    print(i, end=' ')
print()
コード例 #6
0
for i in transform('abCdeFg', str.upper):
    print(i, end=' ')
print()

for i in running_count('bananastand', lambda x: x in 'aeiou'):  # is vowel
    print(i, end=' ')
print()

for i in n_with_pad('abcdefg', 3, None):
    print(i, end=' ')
print()

for i in n_with_pad('abcdefg', 10, '?'):
    print(i, end=' ')
print()

for i in n_with_pad('abcdefg', 10):
    print(i, end=' ')
print()

for i in sequence('abcde', 'fg', 'hijk'):
    print(i, end=' ')
print()

for i in alternate('abcde', 'fg', 'hijk'):
    print(i, end=' ')
print()

# uncomment the following line if you wrote flatten
#for i in flatten([1,2,[3,4,(5,6,7,{'abc':1,'xyz':2}),8,9],10]): print(i,end=' ')
コード例 #7
0
ファイル: generatordriver.py プロジェクト: Yangsilu/database
   
for i in running_count('bananastand',lambda x : x in 'aeiou'): # is vowel
    print(i,end=' ')
print()


for i in n_with_pad('abcdefg',3,None):
    print(i,end=' ')
print()

for i in n_with_pad('abcdefg',10,'?'):
    print(i,end=' ')
print()

for i in n_with_pad('abcdefg',10):
    print(i,end=' ')
print()


for i in sequence('abcde','fg','hijk'):
    print(i,end=' ')
print()


for i in alternate('abcde','fg','hijk'):
    print(i,end=' ')
print()

# uncomment the following line if you wrote flatten
#for i in flatten([1,2,[3,4,(5,6,7,{'abc':1,'xyz':2}),8,9],10]): print(i,end=' ')