I am currently encountering some difficulties, please explain to me first, thank you!
I have created some data in the G2.txt file, the internal node has 16 lines, and I want to arrange these numbers in an orderly manner.
file=open('G2.txt','r')
for line in file.readlines():
transform_str=line.split(',')
number_node=int(transform_str[0])
x=int(transform_str[1])
y=int(transform_str[2])
lst=[number_node]
print(lst)
output:
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
but I want the output as:
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
what should I do?