def replace_entry(line, fieldn, newentry):
 start = _find_start_entry(line, fieldn)
 leng = len(line[start:].split()[0])
 newline = ((line[:start] + str(newentry)) + line[(start + leng):])
 return newline

def replace_entry ( line , fieldn , newentry ) : start = _find_start_entry ( line , fieldn ) leng = len ( line [ start : ] . split ( ) [ 0 ] ) newline = ( ( line [ : start ] + str ( newentry ) ) + line [ ( start + leng ) : ] ) return newline
helper function replace an entry in a string by the field number .