2
my_file = fields.Binary(string='My txt file')

@api.one
def read_file(self):

    filename = self.my_file.decode('base64')
    print(filename)

Print return all data in file!

1  TEST  100 

2  TEST2  200 

3  TEST3  300 

4  TEST4  400

I want get row 1 eg. ('number':1,'name':TEST,'price':100)

Dadep
  • 2,796
  • 5
  • 27
  • 40
Pointer
  • 2,123
  • 3
  • 32
  • 59
  • 1
    Please check this may be help you :https://stackoverflow.com/questions/3277503/how-do-i-read-a-file-line-by-line-into-a-list – Heroic Nov 14 '17 at 11:52

1 Answers1

2

Try this example:

lines = filename.split('\n')
for line in lines:
    print(str(line.split()))
user_odoo
  • 2,284
  • 34
  • 55