下面是我尝试过的代码,我是 python 新手,有人可以告诉我我该怎么做
#opening a 'Newfile' to write in
file_list=open('file_list.txt','w')
#taking the list of file which i have to write in file
list_files = os.system("ls -1 /amxusers7/inf/aimsys/netabp6/ALL_SCRIPTS/VOICE")
#trying to write in a Newfile
file_list.writelines(list_files)
我收到错误:
Traceback (most recent call last):
File "testPuneet.py", line 30, in ?
file_list.writelines(list_files)
TypeError: writelines() requires an iterable argument