3 "Replace tabs with spaces in argument files. Print names of changed files."
13 opts
, args
= getopt
.getopt(sys
.argv
[1:], "t:")
15 raise getopt
.error
, "At least one file argument required"
16 except getopt
.error
, msg
:
18 print "usage:", sys
.argv
[0], "[-t tabwidth] file ..."
20 for optname
, optvalue
in opts
:
22 tabsize
= int(optvalue
)
25 process(file, tabsize
)
27 def process(file, tabsize
):
33 print "%s: I/O error: %s" % (`
file`
, str(msg
))
35 newtext
= string
.expandtabs(text
, tabsize
)
44 os
.rename(file, backup
)
52 if __name__
== '__main__':