470,849 Members | 1,187 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Exception has occurred: AttributeError

import re
from collections import OrderedDict
file = open(input("Input-file name : ") , "r")
fi = file.readlines()## convert to list of lines
key=[]
val=[]
keyapp=False
for line in fi:
if re.match(r'^[^\n(E|P):]*:\s[EXINTF_DATA\d]*\d',line):
#print(line)
tempkey = line.strip()##to remove the newlines when printing
s = tempkey
#s.sort()
#print("temp", tempkey)
key.append(tempkey.replace("Startpoint: ", ""))##replacing / removing the 'Startpoint:'
keyapp=True
if keyapp:
a=key.append(tempkey.replace("Startpoint: ", ""))
b=a.OrderedDict.fromkeys(s)
print(b)




'NoneType' object has no attribute 'OrderedDict'.
could anyone please help me on how to fix it
3 Weeks Ago #1
0 8184

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Harry | last post: by
1 post views Thread by Richard Gordon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.