python - 'list' object has no attribute 'find' -


I know this is a basic question, but I'm new to the python and can not figure out how to do it Be resolved

I have a list of the next example:

  entities = ["# 1 = IFCOG organization ($, 'Autodasc Rev. 2014 (ANU)', $, $, $) "," # 5 = IFCAPPLCATION (# 1, '2014', 'Autodascite Rev. 2014 (ANU)', 'Rev'); "]   

My problem is how Add information from the list to "entities" in a dictionary in the following format:

  dic = {'# 1 = IFCORGANIZATION': ['$', 'Autodesk Revit 2014 ('ENU)', '$', '$', '$'], '# 5 = IFCAPPLICATION': ['# 1', '2014', 'Autodesk Revit 2014 (ENU)', 'Revit']   

I try to do this But I get the following error: There is no attribute in the 'list' object, 'Search' ,

and I do not know How to find it without a method.

You can use to deal with the wires, first of all code strings should be used in the ' ', being done with maxsplit 1:

 in  [48]: dic = dict (e [: - 1] .split' (', 1) in institutions E): #using [: -1] to filter '' '...: print dic ...: {' # 5 = IFCAPPLICATION ': "# 1,' 2014 '' Autodesk Revit 2014 (ENU) ',' Revit ') ",' # 1 = IFCORGANIZATION ':" $,' Autodesk Revit 2014 (ENU) ', $, $, $) "}   

then Split each value with ',' [55]: dic = {k: dic [k] [: - 1] in ',' :

 ] '' # 5 ' = 'IFCAPPLICATION': ['# 1', '' 2014 '', '' Aut Odesk Revit 2014 (ENU) '', '' $ 1 '' 'Autodesk Revit 2014 (ENU)' ',' $ ',' $ ',' $ ']}   

Note that the key-value pairs in any particular word are uncredited, as you can see the '# 1 = IFCORGANIZATION' not showing in the first position.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -