2
regexを使用してテキスト行の一部の時間形式を変更したいとします。 古い時間値はどのように使用できますか? 私のコード今まで:テキストファイルのregexを使ったdatetime値の再フォーマット
def file_replace_words(file_in, word_to_replace, replace_with):
f = open(file_in, "r+")
data = f.readlines()
f.seek(0)
for line in data:
line = re.sub(word_to_replace, replace_with, line)
f.write(line)
f.truncate()
f.close()
f.file_replace_words(path_putty_log, r"(\d\d\/\d\d\/\d\d) - \d\d:\d\d:\d\d:\d\d\d",
"my time in format 31.12.1999 11:54:23")
私は29/09/16から値を変更したい - 16:29.09.16 16時38分09秒に808:38:09。