Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<patient nhs-no="7503557856">
<name>
<first>Joseph</first>
<middle>Michael</middle>
<last>Bloggs</last>
<previous/>
<preferred>Joe</preferred>
<title>Mr</title>
</name>
sno,name,age,img,email,favsite
87653210,Harry Potter,16,hp.png,hpotter@hogwarts.ac.uk,https://wizards.com
12345678,Hermione Granger,16,hg.png,hgranger@hogwarts.ac.uk,https://www.spells.com
04678945,Ronald Weasley,16,rw.png,rweasley@hogwarts.ac.uk,https://www.dragons.net
45321134,Draco Malfoy,17,dm.png,draco@draco.com,https://evilplanning.net
sno name age img email favsite
87653210 Harry Potter 16 hp.png hpotter@hogwarts.ac.uk https://wizards.com
12345678 Hermione Granger 16 hg.png hgranger@hogwarts.ac.uk https://www.spells.com
04678945 Ronald Weasley 16 rw.png rweasley@hogwarts.ac.uk https://www.dragons.net
45321134 Draco Malfoy 17 dm.png draco@draco.com https://evilplanning.net
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
sno|name|age|img|email|favsite
87653210|Harry Potter|16|hp.png|hpotter@hogwarts.ac.uk|https://wizards.com
12345678|Hermione Granger|16|hg.png|hgranger@hogwarts.ac.uk|https://www.spells.com
04678945|Ronald Weasley|16|rw.png|rweasley@hogwarts.ac.uk|https://www.dragons.net
45321134|Draco Malfoy|17|dm.png|draco@draco.com|https://evilplanning.net
<?php
# very important line
@date_default_timezone_set("GMT");
# open a new MySQL connection using PDO
$pdo = new PDO('mysql:host=localhost;dbname=quotes-db', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
# formulate the SQL and run it
$sql = 'SELECT `qid`, `quote`, `s-name`, `wpimg`
FROM `quotes`, `source`
<?php
# very important line
@date_default_timezone_set("GMT");
# open a new MySQL connection using PDO
$pdo = new PDO('mysql:host=localhost;dbname=quotes-db', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
# formulate the SQL and run it
$sql = 'SELECT `qid`, `quote`, `s-name`, `wpimg`
FROM `quotes`, `source`
# modules
import pymysql as pm
import sys
from tabulate import tabulate
try:
# connect to mysql platform
conn = pm.connect(host='localhost', user='root', passwd=None, db='quotes-db')
# create the cursor
<?xml version="1.0" encoding="UTF-8"?>
<organizations>
<record id="1">
<index>1</index>
<organizationId>FAB0d41d5b5d22c</organizationId>
<name>Ferrell LLC</name>
<website>https://price.net/</website>
<country>Papua New Guinea</country>
<description>Manufacturing &amp; sales</description>
<founded>1990</founded>
<?xml version="1.0" encoding="UTF-8"?>
<organizations>
<record id="1">
<index>1</index>
<organizationId>FAB0d41d5b5d22c</organizationId>
<name>Ferrell LLC</name>
<website>https://price.net/</website>
<country>Papua New Guinea</country>
<description>Horizontal empowering knowledgebase</description>
<founded>1990</founded>
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 9 columns, instead of 2 in line 8.
index,organizationId,name,website,country,description,founded,industry,employeesNo
1,FAB0d41d5b5d22c,Ferrell LLC,https://price.net/,Papua New Guinea,Horizontal empowering knowledgebase,1990,Plastics,3498
2,6A7EdDEA9FaDC52,"Mckinney, Riley and Day",http://www.hall-buchanan.info/,Finland,User-centric system-worthy leverage,2015,Glass / Ceramics / Concrete,4952
3,0bFED1ADAE4bcC1,Hester Ltd,http://sullivan-reed.com/,China,Switchable scalable moratorium,1971,Public Safety,5287
4,2bFC1Be8a4ce42f,Holder-Sellers,https://becker.com/,Turkmenistan,De-engineered systemic artificial intelligence,2004,Automotive,921
5,9eE8A6a4Eb96C24,Mayer Group,http://www.brewer.com/,Mauritius,Synchronized needs-based challenge,1991,Transportation,7870
6,cC757116fe1C085,Henry-Thompson,http://morse.net/,Bahamas,Face-to-face well-modulated customer loyalty,1992,Primary / Secondary Education,4914
7,219233e8aFF1BC3,Hansen-Everett,https://www.kidd.org/,Pakistan,Seamless disintermediate collaboration,2018,Publishing Industry,7832
8,ccc93DCF81a3