Use string formatting supported by older pythons

This commit is contained in:
Torben Rasmussen 2014-01-15 10:28:12 -08:00 committed by Tim Pope
parent c4f677ee64
commit c5bfcc93f4

View File

@ -18,7 +18,7 @@ def vim_encode(data):
str_list = []
for c in data:
if (000 <= ord(c) and ord(c) <= 037) or c == '"' or c == "\\":
str_list.append("\\{0:03o}".format(ord(c)))
str_list.append("\\%03o" % ord(c))
else:
str_list.append(c)
return '"' + ''.join(str_list) + '"'