CLRS icon indicating copy to clipboard operation
CLRS copied to clipboard

Write a script to insert a block comment into each code file

Open Mooophy opened this issue 10 years ago • 1 comments

Such as :

//
// @author Yue Wang
// @time [read system time]
//

Seems a dictionary can be used here, like:

dic['author'] = `Yue Wang`

Mooophy avatar Apr 05 '15 11:04 Mooophy

Sample code in Python from SO

f = open("path_to_file", "r")
contents = f.readlines()
f.close()

contents.insert(index, value)

f = open("path_to_file", "w")
contents = "".join(contents)
f.write(contents)
f.close()

tested.

Mooophy avatar Apr 05 '15 11:04 Mooophy