I have a txt file with two values in a single column, one below the other:
0008
001U
I need to use each line in the file to be pasted into a four character field so I'm doing a for loop:
inputFile = open("C:/Users/UserName/Desktop/LCDIVextract.txt", 'r')
lines = inputFile.readlines()
inputFile.close()
for line in lines:
em.fill_field(6, 15, f'{line}', 4)
However I'm getting this error:
py3270.FieldTruncateError: length limit 4, but got "['0008']".
I have tried to replace the undesired characters for blank spaces, I also tried to trim it, but nothing worked. The only way I was able to get my code do what I wanted it's if I explictly wrote:
lines = ["0008","001U"]
for line in lines:
em.fill_field(6, 15, f'{line}', 4)
I'm using py3270 and nothing else. I'm sure there's an error, but I'm not sure where. Any assistance is much appreciated. Thanks!