473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How do I change HTML code to dictionary?

How can I change HTML into a dictionary.
So what I mean is I have some html code...
Expand|Select|Wrap|Line Numbers
  1. <center> <div id="header-content">
  2.             <div id="header-content-left">
  3.                 <a href="index.html" target="_top"><img src="header-image.jpg" id="header-image" alt="Pager"></img><a/>
  4.             </div>
  5.             <div id="header-content-right">
  6.                 <a href="create.html" target="_top"><button id="header-content-right-cp">
  7.                     <p style="font-family:Calibri; font-size:20px; text-align:center;"> Create </p>
  8.                 </button></a>
  9.                 <button id="header-content-right-si">
  10.                     <p style="font-family:Calibri; font-size:20px; text-align:center;" onclick="login()"> Login </p>
  11.                 </button>
  12.                 <button id="header-content-right-so">
  13.                     <p style="font-family:Calibri; font-size:20px; text-align:center;" onclick="logout()"> Logout </p>
  14.                 </button>
  15.                 <div id="header-content-right-pr">
  16.                     <a href="account.html" target="_top"><p style="margin-top:7px; font-family:Calibri; font-size:18px; text-align:center;"> kMcMaxPicAxeYT991 </p></a>
  17.                 </div>
  18.             </div>
  19.             <div id="header-content-right-phone">
  20.  
  21.             </div>
  22.         </div> </center>
and I want it to look like a dictionary...
Expand|Select|Wrap|Line Numbers
  1. {"center":
  2.     {
  3.     "div id="header-content"":
  4.         {
  5.         "div id="header-content-left":
  6.             {
  7.             "a href="index.html" target="_top":
  8.                 {
  9.                 "img src="header-image.jpg" id="header-image"": None
  10.                 }
  11.             }
  12.         "div id="header-content-right"":
  13.             {
  14.             "a href="create.html" target="_top"":
  15.                 {
  16.                 "button id="header-content-right-cp"":
  17.                     {
  18.                     "p style="font-family:Calibri; font-size:20px; text-align:center;"": "Create"
  19.                     }
  20.                 }
  21.             "button id="header-content-right-si"":
  22.                 {
  23.                 "p style="font-family:Calibri; font-size:20px; text-align:center;" onclick="login()"": "Login"
  24.                 }
  25.             "button id="header-content-right-so"":
  26.                 {
  27.                 "p style="font-family:Calibri; font-size:20px; text-align:center;" onclick="logout()"": "Logout"
  28.                 } 
  29.             "div id="header-content-right-pr"":
  30.                 {
  31.                 "a href="account.html" target="_top"":
  32.                     {
  33.                     "p style="margin-top:7px; font-family:Calibri; font-size:18px; text-align:center;"": "kMcMaxPicAxeYT991"
  34.                     }
  35.                 }
  36.             }
  37.         "div id="header-content-right-phone"": None
  38.         }
  39.     }
  40. }
  41.  
Of course I can't just do it myself because different html will be entered each time.
Thanks for the help.
Apr 11 '15 #1
1 1596
dwblas
626 Expert 512MB
Once you get deeper than a dictionary of dictionaries you should be using SQL IMHO, which can be used to find a match on multiple fields if that is what you want to do. See this link for starters http://zetcode.com/db/sqlitepythontutorial/
Apr 11 '15 #2

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

Similar topics

8
by: Marcel | last post by:
hi, when i put data in my mysql table on mine local webserver it appears only when i change the html code of the page that contains the php code. I already put the meta-tag 'no-chache' on mine...
18
by: Gr8DaddyG | last post by:
I am trying to paste the following code into the HTLM editor of my webpage: <script...
6
by: Peter Afonin | last post by:
Hello, I'm creating something like a web site builder in ASP.Net, and I need to store an HTML code in the SQL server table. If my customer just enters an HTML code, it is stored in the SQL...
5
by: Guoqi Zheng | last post by:
I think I have this kind of problem very often, now it is really making me crazy. VS.NET always want to change my html code. Ok, that is fine as long as Vs.Net can ask my confirmaton first. For...
4
by: Ganesh Muthuvelu | last post by:
Hello, I was wondering if there is a way to store all the HTML element information in a database and then dynamically generate the HTML code for a page?.. Basically, I do not want to design every...
2
by: WhatsPHP | last post by:
Can PHP be used to change my clients static HTML pages? By themselves? Instead of having to download the HTML from the server, then use dreamweaver and upload the file back? Thanks Rohan
3
by: Axel Gallus | last post by:
I wrote a javascript function which should return the html code between a frame's body tag: function load_frame_as_string( Framename ) { var Frame =...
6
by: VishalK | last post by:
Friends.. I have a HTML file. Using HTML Code, I want to change its file extension from .html to .mht. eg : TestFile.html to be converted to TestFile.mht Anybody has any idea about this ? Please...
0
by: Formula | last post by:
Hello everybody,because I am newbie in python two weeks only but I had programming in another languages but the python take my heart there's 3 kind of arrays Wow now I hate JAVA :) . I am working...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.