2016-06-23 5 views
0

내 문제는 통역인쇄 명령은

File "C:\Users\Salam\Desktop\kasiskiAttack.py", line 36 
    print "%-10s %3d" % (sub, found+l) 
        ^
SyntaxError: invalid syntax 

이 오류이며,이 내 코드입니다. 당신이 py3에 있다면 내가 print ("%-10s %3d" % (sub, found+l)) 을 시도

def findsubs(text, l, list_ocurrences): 
    for i in range(len(text)-l): 
     sub = text[i:i+l] 
     found = text[i+l:].find(sub) 
     if found != -1: 
      f = found+i+l 
      if i>0 and text[i-1:i+l] == text[f-1:f+l]: 
       continue 
      if i+l < len(text) and text[i:i+l+1] == text[f:f+l+1]: 
       continue    
      print "%-10s %3d" % (sub, found+l) 
      a = found+l 
      list_ocurrences.append(a)  
    return list_ocurrences 
+1

이 파이썬 2 또는 3? –

+0

"print ("% - 10s % 3d "% (sub, found + l))"을 시도 했습니까? –

+0

당신은'print()'와 함께 가고 싶을 수도 있습니다. –

답변

0

프롬프트 쉘 명령에서 사용하는 것이