Skip to content

Instantly share code, notes, and snippets.

quote|author|dob-dod|source|tags
It is a capital mistake to theorize before one has data.|Sir Arthur Conan Doyle|1859-1930|Sherlock Holmes|data, theory
When action grows unprofitable, gather information; when information grows unprofitable, sleep.|Ursula K. LeGuin|1929-2018|The Left Hand of Darkness|action, information, profit
The problems are solved, not by giving new information, but by arranging what we have known since long.|Ludwig Wittgenstein|1889-1951|Philosophical Investigations|philosophy, information
Opinion is usually something which people have when they lack comprehensive information.|Idries Shah|1924-1996|Reflections|opinion, information
Logic takes care of itself; all we have to do is to look and see how it does it.|Ludwig Wittgenstein|1889-1951|Tractatus Logico-Philosophicus|philosophy, logic
The world is all that is the case.|Ludwig Wittgenstein|1889-1951|Tractatus Logico-Philosophicus|philosophy, logic
import xmltodict
import json
with open("quotes.xml") as xml_file:
data_dict = xmltodict.parse(xml_file.read())
json_data = json.dumps(data_dict, indent=2)
print(json_data)
<?xml version="1.0" encoding="UTF-8"?>
<quotes>
<quote id="82" tags="science, wisdom">
<quote>Reality is that which, when you stop believing in it, doesn't go away.</quote>
<source>
<name>Phillip K Dick</name>
<dob>1928</dob>
<dod>1982</dod>
<wplink>http://en.wikipedia.org/wiki/Philip_K._Dick</wplink>
<wpimg>https://upload.wikimedia.org/wikipedia/commons/3/36/Philip_K_Dick_in_early_1960s_%28photo_by_Arthur_Knight%29_%28cropped%29.jpg</wpimg>
import pandas
from sqlalchemy import *
try:
engine = create_engine("mysql+pymysql://{user}:{pw}@localhost/"
.format(user="root",
pw=""))
DB_NAME = "booksdb"
book_id_fk author_id_fk
1 1
2 2
author_id author_lname author_fname
1 Ward Colin
2 Kinna Ruth
publisher_id publisher_name
1 OUP Oxford
2 Oneworld Publications
book_id_fk class_id_fk
1 2
1 7
1 12
2 2
2 12
2 10
2 15
class_id class_name
1 atheism
2 anarchism
3 anthropology
4 anthology
5 autobiography
6 biography
7 ethics
8 feminism
9 history
book_id isbn-10 isbn-13 book_title book_currency book_rrp book_price book_stock book_format book_pages book_publish_date book_description publisher_id_fk
1 0192804774 9780192804778 Anarchism: A Very Short Introduction GBP 7.99 5.99 8 Paperback 128 2004-10-21 Ward considers anarchism from a variety of perspectives: theoretical, historical, and international. The text also explores the ideas of key anarchist thinkers from Kropotkin to Chomsky. 1
2 1851687173 9781851687176 Anarchism: A Beginner's Guide GBP 9.99 7.43 7 Paperback 192 2009-09-01 &quot;A valuable contribution to our understanding of this much misunderstood philosophy.&quot; - Howard Zinn, author of A People's History of the United States &quot;Ruth Kinna cannot be praised highly enough for writing a comprehensive, original and sympathetic work which will no doubt come to be viewed as the key text on the subject.&quot; - Simon Tormey, Professor of Politics, University of Nottingham 2