Finish the last commit

This commit is contained in:
Crista Lopes
2019-12-24 06:47:54 -08:00
parent 6e1d72bd21
commit 0520c182be
3 changed files with 6 additions and 19 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys, re, operator, string import sys, re, operator, string
from threading import Thread from threading import Thread
from queue import Queue from queue import Queue

View File

@@ -1,13 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys, re, operator, string import sys, re, operator, string
from functools import reduce from functools import reduce
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
# #
# Functions for map reduce # Functions for map reduce
# #
@@ -17,7 +10,7 @@ def partition(data_str, nlines):
into chunks of nlines. into chunks of nlines.
""" """
lines = data_str.split('\n') lines = data_str.split('\n')
for i in xrange(0, len(lines), nlines): for i in range(0, len(lines), nlines):
yield '\n'.join(lines[i:i+nlines]) yield '\n'.join(lines[i:i+nlines])
def split_words(data_str): def split_words(data_str):

View File

@@ -1,13 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys, re, operator, string import sys, re, operator, string
from functools import reduce from functools import reduce
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
# #
# Functions for map reduce # Functions for map reduce
# #
@@ -17,7 +10,7 @@ def partition(data_str, nlines):
into chunks of nlines. into chunks of nlines.
""" """
lines = data_str.split('\n') lines = data_str.split('\n')
for i in xrange(0, len(lines), nlines): for i in range(0, len(lines), nlines):
yield '\n'.join(lines[i:i+nlines]) yield '\n'.join(lines[i:i+nlines])
def split_words(data_str): def split_words(data_str):