Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Reading XML file for modification
#python 3.5.2 lines = '''<entry rowname="1">a</entry> <entry rowname="1">a</entry> <entry rowname="2">b</entry> <entry rowname="2">b</entry> <entry rowname="2">b</entry> <entry rowname="3">c</entry> <entry rowname="3">c</entry> <entry rowname="4">d</entry> <entry rowname="5">e</entry> <entry rowname="5">e</entry>''' last_num = "" lines = lines.split("\n") for i, line in enumerate(lines): arr = line.split('"') if arr[1] != last_num: lines[i-1] = lines[i-1] + "TEST" last_num = arr[1] print("\n".join(lines))
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Binary Search and Shell Sort in Python
HW. Bubble Sort Descending Order
spoj ANARC09A
My Intro
Hello world
Atur cara mengira luas dan isipadu sebuah trapezium
crown pattern
Atur Cara Mizan 2
PyEnum
Contact Class
Please log in to post a comment.