Python学习记录

Python的创始人为
吉多·范罗苏姆
(Guido van Rossum)
Python(英国发音:/ˈpaɪθən/ 美国发音:/ˈpaɪθɑːn/),是一种面向对象、直译式的电脑程序语言。它包含了一组功能完备的标准库,能够轻松完成很多常见的任务。它的语法简单,与其它大多数程序设计语言使用大括号不一样,它使用缩进来定义语句块。
与Scheme、Ruby、Perl、Tcl等动态语言一样,Python具备垃圾回收功能,能够自动管理内存使用。它经常被当作脚本语言用于处理系统管理任务和网络程序编写,然而它也非常适合完成各种高级任务。Python虚拟机本身几乎可以在所有的操作系统中运行。使用一些诸如py2exe、PyPy、PyInstaller之类的工具可以将Python源代码转换成可以脱离Python解释器运行的程序。
Python的官方解释器是CPython,该解释器用C语言编写,是一个由社区驱动的自由软件,目前由Python软件基金会管理。
Python支持命令式程序设计、面向对象程序设计、函数式编程、面向侧面的程序设计、泛型编程多种编程范式。
Flask Markdown使用方法
2018年07月12日
在flask中使用Markdown的时候,参考了这篇文章:Flask实现Markdown在线编辑与解析导入这样写:from flask_markdown import Markdown结果报如下错误:ModuleNotFoundError: No module named 'flask_markdown'参考了这篇文章:Flask-MarkdownError when importing flas...
flask url 转换器
2018年07月12日
在Flask中定义路径时,可以指定将转换为Python变量并传递给视图函数的部分。@app.route('/user/<username>') def profile(username): pass无论标记的URL部分是什么,都<username>将作为username参数传递给视图。您还可以指定转换器,以便在将变量传递给视图之前对其进行过滤。@app.route('/user/id/...
flask url_for 如何使用
2018年07月12日
Flask提供了url_for()辅助函数,url_for()最简单的用法是以视图函数名作为参数,返回对应URL。例如:当当调用url_for('index')得到的结果是/,调用url_for('index', _external=True)返回的是绝对地址。如果在本博客上调用则返回:https://pdf-lib.org/。使用url_for()生成动态地址时,将动态部分关键字传入。例如:ur...
SQLAlchemy 如何更新数据库
2018年07月10日
最近修改了模型,没有更新数据库,提交数据报错,具体报错内容如下:sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1054, "Unknown column 'body' in 'field list'") [SQL: 'INSERT INTO article (title, body, body_html...
AttributeError: Neither 'ColumnClause' object nor 'Comparator' object has an attribute 'dispatch'
2018年07月06日
最近在使用Python SQLAlchemy的时候报如下错误:AttributeError: Neither 'ColumnClause' object nor 'Comparator' object has an attribute 'dispatch'看了一下代码:# 文章相关表 class Article(db.Model): __tablename__ = 'article' ...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-ow5feu0g/pycurl/
2018年07月05日
最近要在服务器上面部署一个应用程序,但是安装的时候出现了一下问题:(venv) root@vps6:/var/pppoe-server# pip install pycurl Collecting pycurl Downloading https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52...
from flask.ext.pagedown import PageDown
2018年07月05日
最近使用python的时候,需要用到pagedown,安装之后报如下错误:Usage: python -m flask run [OPTIONS] Error: While importing "manage", an ImportError was raised: Traceback (most recent call last): File "E:\Python\SMS_Re...
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
2018年07月05日
I wanted to install scrapy in virtualenv using pip (Python 3.5) but I get the followingerror: command 'x86_64-linux-gnu-gcc' failed with exit status 1I tried with Python 2.7 but I get the same errorfo...