3 "Replace tabs with spaces in argument files. Print names of changed files."
12 opts
, args
= getopt
.getopt(sys
.argv
[1:], "t:")
14 raise getopt
.error
, "At least one file argument required"
15 except getopt
.error
, msg
:
17 print "usage:", sys
.argv
[0], "[-t tabwidth] file ..."
19 for optname
, optvalue
in opts
:
21 tabsize
= int(optvalue
)
24 process(file, tabsize
)
26 def process(file, tabsize
):
32 print "%s: I/O error: %s" % (`
file`
, str(msg
))
34 newtext
= text
.expandtabs(tabsize
)
43 os
.rename(file, backup
)
51 if __name__
== '__main__':