Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Reading XML file
#python 3.5.2 lines = '''<entry rowname="111">a</entry> <entry rowname="111">a</entry> <entry rowname="111">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="51">e</entry> <entry rowname="51">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
Python_Hello_World
Komalsri123
InsertionSort
Ej2_python_204676887
Inheritance.py
ElaineBrown** rextester.com
sai hw user enter table
Python
linked_lists
mean