0

I was making my simple filereader using python and cpython. But, I realized that it displayed an error that is TypeError: 'list' object has to attribute to find. Is there any way to find a specific character inside a list and return it? Thanks :D

Main python module

import io;

class AdvancedReader(object):
  def __init__(self, file, mode=None, buffering=None, encoding=None, *args):
    data_file = io.open(file, mode=mode, buffering=buffering, encoding=encoding)
    striped_list = [lines.strip() for lines in (data_file.readlines())]
    if any(map('['.startswith and ']'.endswith, striped_list)):
       _starter = ([for item in striped_list.startswith('[')])
       # stater = striped_list.filter('[', ‘]’) #Removing brackets

Simple using for class

AdvancedReader('settings.def', mode='r', buffering=-1, encoding='utf-8')

This is the atributte error that displayed inside my class...

Traceback (most recent call last):
File "main. py"
, line 13, in «module>
AdvancedReader("settinas.def".mode='r', buffering=-1. encoding='utf-g)
File "main.py", line 9, in
init
print(striped list. find(r))
AttributeError: list' object has no attribute 'find'

This is the settings.def file, its practically a new type of storage/file systax for python only.

[SYSTEM] // Begining acronym
 start: os.system('echo hello world')
[/SYSTEM] // Ending acronym

0 Answers0