Extract only the number after the URL in Python?

  python, python-3.x

I embedded the ontology and now I have the URI with the embedded number. So I could not find a solution. Here is my data on how it looks.

http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#MolecularCompositionPercentage -4.123444 -2.5054626 0.6315763
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#ActivatorMolCompPercentage -4.110525 -2.5071502 1.8669895
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#CaO_MolCompPerc -1.5034174 -1.2245587 0.004379553
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#TiO2_MolCompPerc -1.5249356 -1.2280324 0.014157391
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#Na2O_MolCompPerc -1.5057676 -1.2214838 0.008744555
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#Fe2O3_MolCompPerc -1.5426993 -1.2505695 -0.0022504963
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#K2O_MolCompPerc -1.5550603 -1.2507081 0.030926235
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#MgO_MolCompPerc -1.5091093 -1.2426957 -0.01673266
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#MnO_MolCompPerc -1.5519857 -1.2486249 0.005432705
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#Al2O3_MolCompPerc -1.582312 -1.2757595 -0.012372944
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#Cl_MolCompPerc -1.5798051 -1.2659851 0.0036723414
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#LossOnIgnition_MolCompPerc -1.5719161 -1.2368073 0.0034897649
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#SiO2_MolCompPerc -1.5483932 -1.2457571 0.025666924
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#SO3_MolCompPerc -1.5837562 -1.2600871 -0.009976057
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#P2O5_MolCompPerc -1.6092789 -1.2806703 -0.0026384927
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#WaterMolCompPercentage -4.8089037 -2.8734853 0.88688195
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#PowderStructure -1.4129046 -1.598844 3.1255267
http://www.semanticweb.org/btorres/ontologies/2021/7/AAC_Ontology#SiO2(mol-) -3.9019644 -2.430823 2.3417187```


For example, in the first line I want to get only these numbers: ```-4.123444 -2.5054626 0.6315763```. Please help me with how to do it.

  my_list = []
  with open('3D_10W_Hermit.txt' , newline='') as f:
      for line in f:
          my_list.append(line[-1])




Source: Python-3x Questions

LEAVE A COMMENT