if statement - python else syntax error -
this python script process string suffering syntax error in line 24, else:
.
any ideas might be?
j=raw_input("enter string: ") import os def addtoclipboard(text): command = 'echo ' + text.strip() + '| clip' os.system(command) def parse(string): result="" linelist=string.split("\n") in range(len(linelist)): h=linelist[i].split("@") if len(h)<2: continue if len(h)>2: count=0 x in range(len(h)): if x==len(h)-1: continue re0=count+len(h[x])+(x*1) re1=i+1 re3=str(re1)+"-"+str(re0) result+=str(re3)+", " count+=len(h[x]) else: re0=len(h[0]) re1=i+1 re3=str(re1)+"-"+str(re0) result+=str(re3)+", " result =result[:-2] addtoclipboard(result) print result parse(j)
it's problem indentation level of else
, make sure align @ same level of corresponding if
. please use ide or text editor catch kind of errors. is, it's impossible se intended code.
Comments
Post a Comment