<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://techdoku.nogafam.es/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://techdoku.nogafam.es/feed.php">
        <title>NoBIGTech Wiki Técnico - docu:csheet:sysadm:script:python</title>
        <description></description>
        <link>https://techdoku.nogafam.es/</link>
        <image rdf:resource="https://techdoku.nogafam.es/lib/exe/fetch.php?media=wiki:dokuwiki.svg" />
       <dc:date>2026-04-27T10:29:24+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:argparse&amp;rev=1581686121&amp;do=diff"/>
                <rdf:li rdf:resource="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:html_scraping&amp;rev=1642299224&amp;do=diff"/>
                <rdf:li rdf:resource="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:read_csv&amp;rev=1641390530&amp;do=diff"/>
                <rdf:li rdf:resource="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:sort_by_key&amp;rev=1641390352&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://techdoku.nogafam.es/lib/exe/fetch.php?media=wiki:dokuwiki.svg">
        <title>NoBIGTech Wiki Técnico</title>
        <link>https://techdoku.nogafam.es/</link>
        <url>https://techdoku.nogafam.es/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:argparse&amp;rev=1581686121&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-02-14T13:15:21+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>argparse</title>
        <link>https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:argparse&amp;rev=1581686121&amp;do=diff</link>
        <description>How to use argparse on python3



The goal is to provide to your application, a strong command line options support, and be easy to program as well as to use it.


# basic initialization
import argparse
parser = argparse.ArgumentParser(description=&#039;The description of your handy tool&#039;)

# create a mutually exclusive group of parameters
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(&#039;--ping&#039;, action=&#039;store_true&#039;, help=&#039;(example) a flag to ping your application&#039;)
grou…</description>
    </item>
    <item rdf:about="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:html_scraping&amp;rev=1642299224&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-01-16T02:13:44+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>html_scraping</title>
        <link>https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:html_scraping&amp;rev=1642299224&amp;do=diff</link>
        <description>Simple guide for HTML Web Scraping



Install the packages required.


# Debian-based
apt install python3-bs4
apt install python3-requests

# using pip
pip install bs4
pip install requests




Sample code for parsing:


# obtain html using requests
response = requests.get(&#039;http://example.org&#039;)
html = BeautifulSoup(response.text, &#039;html.parser&#039;)

# get page title
print(html.title)

# select using DOM selector (list of elements)
elements = html.select(&#039;#your-id .your-class a[href=&quot;value&quot;]&#039;)

# exam…</description>
    </item>
    <item rdf:about="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:read_csv&amp;rev=1641390530&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-01-05T13:48:50+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>read_csv</title>
        <link>https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:read_csv&amp;rev=1641390530&amp;do=diff</link>
        <description>Read a CSV file to JSON, using the first rows as field names definition



If you just want to create your own code from scratch, with the very basic .csv reading code, this is the snippet you need:


def read_csv_data(fname):
    with open(fname) as csvfile:
        reader = csv.reader(csvfile, delimiter=&#039;,&#039;)
        for row in reader:
            print(row)</description>
    </item>
    <item rdf:about="https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:sort_by_key&amp;rev=1641390352&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-01-05T13:45:52+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sort_by_key</title>
        <link>https://techdoku.nogafam.es/doku.php?id=docu:csheet:sysadm:script:python:sort_by_key&amp;rev=1641390352&amp;do=diff</link>
        <description>Sort an Array by a key value



In case you want an array [] ordered by a numeric value in items wanted by key:


# numeric ascending order
data = sorted(data, key=lambda x: x[&#039;yourkey&#039;])

# numeric descending order
data = sorted(data, reverse=True, key=lambda x: x[&#039;yourkey&#039;])</description>
    </item>
</rdf:RDF>
