I need to add numbers to each value according to a certain sequence.
My code:
f = open("demofile.txt", "r")
lines = f.readlines()
for i in list(lines):
w = i[3:]
w = ', '.join(w.split())
#print(w)
#time.sleep(1)
y = i[2]
y=int(y)+1
#print(y)
c1=np.array([w])
c1 = [int(i) for i in c1[0].replace(" ", "").split(",")]
c1=np.array([c1]*3)
c1=np.transpose(c1)
a=str(c1).replace("[",'')
a=str(a).replace("]",'')
a=str(a).replace("\n ",'\n')
#print('\n')
print(a)
Input:
<=1 1 2 3
<=1 4 5 6
My Output:
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
I need:
011 021 031
012 022 032
013 023 033
044 054 054
045 055 065
046 056 066
... etc.
I tried to write it by hand but it is not effective.
<= 1 1 2 3 <= 1 4 5 6. In the comments above, you've mentioned that the first integer of input sequence is1 1 1. That seems to be a contradiction. Please clarify what exactly is your input. Also please clarify whether the input you are describing is ALWAYS the input or just a SAMPLE input. Please provide all clarifications by editing your posted question, and briefly refer to the edits, in your comments.