I'm very new to python
and I have diff text like this
<revision>
- <count>22</count>
+ <count>33</count>
</revision>
this is config file changes
everywhere that you + means line added
and everywhere that you see - means something removed
it is like git.
the problem is that above text is not readable.
I want something like this:
revision->count : 22 (old) 33 (new)
so , how can I start for doing that?
is it needed to use library?
you can use split
function:
a = string.split('<count>')
b, c = a[1], a[3]
final = 'revision->count : {} (old) {} (new)'.format(int(b), int(c))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.