Demo entry 6677784

Bloc 1

   

Submitted by anonymous on Dec 04, 2017 at 15:20
Language: Python 3. Code size: 633 Bytes.

# Fonction retournant une thématique en fonction du contenu de l'URL

def page_theme(url):
    """ Assignation d'une thématique en fonction du contenu de l'URL """

    theme = ""
    
    if (re.search('^/$', url)):
        theme = 'Home'
        
    elif (re.search('(fen(e|ê)tre|(baie(.*)vitr(é|e))', url)):
        theme = 'Fenêtre'
        
    elif (re.search('porte.*garage', url)):
        theme = 'Porte de garage'
        
    elif (re.search('(sol|mur|carrelage|parquet|lambri|parement)', url)):
        theme = 'Sols et murs'
        
    else:
        theme = 'Undefined'
        
    return theme

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).