Doug Potter wrote:
> Hi,
> 
> I at trying to create a bunch of text files in a single directory on a 
> Linux system,
> something like this.
> 
> import os
> 
> routers = ['adnc-6321', 'adnp-2341', 'adnw-2632']
> 
> for i in routers:
>     os.system('/bin/touch' %s) % i
> 
> of course this dosn't work.

try using the following:

for i in routers:
        os.system('/bin/touch %s' % i)

> Is there a simple way to get this done?

You can also use the builtin file object:

for i in routers:
        f = file(i, 'w')
        f.close()

> Thanks for your time.
> _______________________________________________
> Tutor maillist  -  [email protected]
> http://mail.python.org/mailman/listinfo/tutor

-- 
Carlos Hanson
Web Specialist
Tigard-Tualatin School District
503.431.4053
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to