Python外壳输出为单独的行
我是python新手,需要一些帮助。 这是我的代码:Python外壳输出为单独的行,python,list,Python,List,我是python新手,需要一些帮助。 这是我的代码: import subprocess direct_output = subprocess.check_output('find / -type f -name \"*.srt\"', shell=True) print direct_output 我有如下输出: /path/to/my/code/name.srt /path/to/my/code/other_name.srt 但我想一个接一个地列出这些输出。比如: 直接打印输出[1]
import subprocess
direct_output = subprocess.check_output('find / -type f -name \"*.srt\"', shell=True)
print direct_output
我有如下输出:
/path/to/my/code/name.srt
/path/to/my/code/other_name.srt
但我想一个接一个地列出这些输出。比如:
直接打印输出[1]
输出:
/path/to/my/code/other_name.srt
为什么不使用python函数(glob?)执行此任务的原因可能重复?你真的想要一个不同的过程吗?可能重复读取