質問

私が使用しています:

file = tkFileDialog.askopenfile(parent=root, mode='rb', 
       filetypes=[('Subrip Subtitle File','*.srt')], title='Choose a subtitle file')

ユーザーが指定したファイルオブジェクトを取得します。

私は、ファイルオブジェクトからこのファイルの絶対パスを取得することができます任意の方法はありますか?

役に立ちましたか?

解決

file = tkFileDialog.askopenfile(parent=root,mode='rb',filetypes=[('Subrip Subtitle File','*.srt')],title='Choose a subtitle file')
abs_path = os.path.abspath(file.name)

他のヒント

os.path.abspath のあなたが欲しいものを行う必要があり、私が正しくあなたの質問を理解していれば。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top