2
私は、ターミナルを通過するpythonスクリプトを書いています。私は、VIMでPythonファイルを開いてコードを書いています。私は現在、(VIMエディタで開きます)Vimのファイルに私を取得する次のコードを使用しています:Pythonスクリプトのvimエディタでコードを書く
#!/usr/bin/env python
import ctypes
import os
def is_hidden(filepath):
name = os.path.basename(os.path.abspath(filepath))
return (name) or (has_hidden_attribute(filepath))
def has_hidden_attribute(filepath):
try:
attrs = ctypes.windll.kernel32.GetFileAttributesW(unicode(filepath))
assert attrs != -1
result = bool(attrs & 2)
except (AttributeError, AssertionError):
result = False
return result
def main():
print("found:",is_hidden('~/.jupyter'))
#write cd ~/.jupyter in bash terminal
os.system('~/.jupyter') #change to be ~/name
os.system('vim file')
if __name__ == "__main__": main()
os.systemを使用して(「vimのファイルは、」)のvimでファイルを開き、ときに私が実行されますスクリプト、空のファイルが表示されています。私は、この空のファイルをpythonスクリプトで書き、保存して終了します。
どうすればいいですか?
のvimを介してこれをやりたいと思っためのあなたの理由は何であると、ファイルへの
書くのか?なぜファイルを直接書き込まないのですか? – FamousJameous
これが私ができることならば、私は本当に興味があります。 vimにアクセスしてvimに書き込みます。 :) – Emily
私はそれを尊重することができます。残念ながら、私はあなたを助ける方法を知らない、申し訳ありません。 – FamousJameous