ときどき、私の Python スクリプト内の ID が突然、破損していると言えます。ID が突然変更され、プログラムが失敗します。
cat を使用してファイルを見ると、識別が間違っていることがわかります。しかし、VIM内では問題なく表示されます。ここに出力と設定があります。
何か案は ???
「cat -e」経由
validate_hostname = RegexValidator(regex=r'[a-zA-Z0-9-_]*\.[a-zA-Z]{2,6}',message="Enter a valid hostname.")$
validate_hostname(host_input)$
except ValidationError, e:$
print type(e)$
print str(e[0])$
error = str(e)$
else:$
error = "Please complete all fields." $
$
print error$
return [error,host_input,record_input]$
VIM内で、
validate_hostname = RegexValidator(regex=r'[a-zA-Z0-9-_]*\.[a-zA-Z]{2,6}',message="Enter a valid hostname.")
validate_hostname(host_input)
except ValidationError, e:
print type(e)
print str(e[0])
error = str(e)
else:
error = "Please complete all fields."
print error
return [error,host_input,record_input]
私の.vimrcは次のようになります。
syntax on
se bg=dark
set tabstop=4 " insert 4 spaces when a tab is pressed
set shiftwidth=4 " change the number of space characters inserted for indentation
set expandtab " insert spaces whenver a tab key is pressed