Use string formatting supported by older pythons
This commit is contained in:
parent
c4f677ee64
commit
c5bfcc93f4
@ -18,7 +18,7 @@ def vim_encode(data):
|
|||||||
str_list = []
|
str_list = []
|
||||||
for c in data:
|
for c in data:
|
||||||
if (000 <= ord(c) and ord(c) <= 037) or c == '"' or c == "\\":
|
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:
|
else:
|
||||||
str_list.append(c)
|
str_list.append(c)
|
||||||
return '"' + ''.join(str_list) + '"'
|
return '"' + ''.join(str_list) + '"'
|
||||||
|
Loading…
Reference in New Issue
Block a user