function.py

来自「在python应用文件写入写出的几个小函数」· Python 代码 · 共 41 行

PY
41
字号
#! /usr/bin/env python
# -*- coding: Latin-1 -*-


#==========================================================
# nom du fichier : writeInHTML.py


# description : fonctions utiles
# ===========================================================

# 閏rit l'en-t阾e HTML
def beginHTMLFile():
    return "<html>\n<head>\n<title>write source code in HTML</title>\n</head>\n<body>\n<pre>\n"

# 閏rit la fin du fichier HTML
def endHTMLFile():
    return "\n</pre>\n</body>\n</html>"

# renvoie vrai si la variable c contient un saut de ligne
# une tabulation ou un espace
def isSpace(c):
    return (c =='\n' or c == '\t' or c == ' ' or c == '\0')

# renvoie vrai si la variable c est un caract鑢e de ponctuation
def isPunctuation(c):
    return (c == '.' or c == ',' or c == ';' or c == ':' or c == '?' or c == '!' or c == '\'' or c == '/' or c == '*')

# renvoie vrai si c est une parenth鑣e, une accolade ou un crochet
def isBracket(c):
    return (c == '(' or c == ')' or c == '[' or c == ']' or c == '{' or c == '}')

# revoie vrai si c est un caract鑢e sp閏ial
def isSpecialDelim(c) :
    return (c == '\"' or c == '&' or c == '<' or c == '>')

# renvoie vrai si c est un d閘imiteur
def isDelimitor(c):
    return (isSpace(c) or isPunctuation(c) or isSpecialDelim(c) or isBracket(c))

# renvoie le code html d'un d閘imiteur sp閏ial c pass

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?