Menu

[Solved]Python Could Someone Help Append Specific Content Textile Empty Lists Written Code Appendi Q37032741

Python: Could someone help meappend specific content from atextile to empty lists? I havewritten the code below but it is not appending anything to theempty lists.

file= open(‘mytextfile.txt’,’r’)
content= file.read()
l= []
l2=[]
l3=[]

for line in content:
if ‘hi’ in line:
l.append(content)
if “a:” in line or “b:” in line or “c:” in line or “s:” in line or”d:” in line:
l2.append(content)
if ‘b:’ in line:
l3.append(content)

print(l)–> EMPTY list; not appending
print(l2)–> EMPTY list; not appending
print(l3)—> EMPTY List; not appending

Expert Answer


Answer to Python: Could someone help me append specific content from a textile to empty lists? I have written the code below but i… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *