当我在集群中运行mapper.py文件时,它有一个问题。错误是“strl=line.strip()中的”unexpected syntax before line“。在本地测试时没有错误。我想把文本文件中的单词存储起来,改变它们的格式,对它们进行计数,然后发送到s3 bucket中的输出。
非常欢迎指导。谢谢
Map器:
import sys, re
for line in sys.stdin:
strl = line.strip()
words = strl.split()
for word in words:
word = word.lower()
result = ""
charref = re.compile("[a-f]")
match = charref.search(word[0])
if match:
result+= "TR2234J"
else:
result+= ""
print result, "\t"
减速器:
import sys
for line in sys.stdin:
line = line.strip()
new_word =""
words = line.split("\t")
final_count = len(words)
my_num = final_count / 6
for i in range (my_num):
new_word = "".join(words[i*6:10+(i*6)])
print new_word, "\t"
暂无答案!
目前还没有任何答案,快来回答吧!