Python os.system('dir') points to 'C:\' not 'C:\myfolder\' -


python os.system('dir') points 'c:\' instead of 'c:\myfolder\'. ideas why , how can fix it? environment: windows 7, python3.4

please check if works you.

import os #will print current working directory content #that script present os.system("dir") print "---------------------------------" #will print content of c:\python27 os.system("dir c:\python27") 

output

c:\users\administrator\desktop>python chk.py  volume in drive c has no label.  volume serial number 2a3d-7b34   directory of c:\users\administrator\desktop  08/28/2015  01:56 pm    <dir>          . 08/28/2015  01:56 pm    <dir>          .. 08/19/2015  02:27 pm        27,156,654 a.bmp 08/31/2015  11:33               187 chk.py 08/28/2015  11:20               234 data.txt 08/13/2015  04:07 pm               502 eclipse - shor 08/13/2015  03:39 pm               502 eclipse - shor 06/24/2015  05:28 pm           876,888 freesshd.exe 08/27/2015  11:45 pm               970 freesshd.lnk 05/27/2014  08:54             1,073 notepad++.lnk 05/21/2014  09:59             1,892 p4v.lnk 05/20/2014  12:39 pm           520,192 putty.exe 08/28/2015  01:55 pm           567,978 sample.txt               11 file(s)     29,127,072 bytes                2 dir(s)  15,955,296,256 bytes free ---------------------------------  volume in drive c has no label.  volume serial number 2a3d-7b34   directory of c:\python27  05/20/2014  08:00 pm    <dir>          . 05/20/2014  08:00 pm    <dir>          .. 05/20/2014  08:00 pm    <dir>          dlls 05/20/2014  08:00 pm    <dir>          doc 05/20/2014  08:00 pm    <dir>          include 08/28/2015  10:20    <dir>          lib 05/20/2014  08:00 pm    <dir>          libs 11/10/2013  07:28 pm            38,573 license.txt 11/10/2013  11:15           375,685 news.txt 11/10/2013  07:24 pm            27,136 python.exe 11/10/2013  07:24 pm            27,648 pythonw.exe 10/27/2013  05:01 pm            55,208 readme.txt 05/20/2014  08:00 pm    <dir>          tcl 05/20/2014  08:00 pm    <dir>          tools                5 file(s)        524,250 bytes                9 dir(s)  15,955,296,256 bytes free 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -