2014-11-04 78 views
0

你好我想朗姆酒C *的.o使用Python 2.6.5如下os.command赋予属性错误

import os 
import sys 
file_type = os.command('./file_type.o %s.txt 2>&1' % file_name) 

而且,它提供了错误信息:

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
AttributeError: 'module' object has no attribute 'command' 

作为初学者这可能是一个非常微不足道的问题,我请求指导/帮助。

+0

你从哪里读到'os.command()'是做这件事的方法? – 2014-11-04 05:12:20

回答

1

os模块中没有名为command的功能,因此出现此错误。您可能打算拨打os.system()来代替。

0

os.command不存在,使用os.system来代替。