Flask

Python面试题之Python面试题汇总

三世轮回 提交于 2021-02-17 12:24:25
参考地址 目录 Python基础篇 1:为什么学习Python 2:通过什么途径学习Python 3:谈谈对Python和其他语言的区别 Python的优势: 4:简述解释型和编译型编程语言 5:Python的解释器种类以及相关特点? 6:位和字节的关系 7:b、B、KB、MB、GB的关系 8:PE8规范 9:通过代码实现如下转换(进制之间转换) 10:请编写一个函数实现将IP地址转换成一个整数 11、python递归的最大层数?998 12:求结果(and or or) 运算符 13 :ascii、unicode、utf-8、gbk 区别 14:字节码和机器码的区别 15:三元运算写法和应用场景? 16:Python3和Python2的区别? 17:用一行代码实现数值交换 18:Python3和Python2中int和long区别 19:xrange和range的区别 20:文件操作时:xreadlines和readlines的区别? 21: 列列举布尔值为False的常见值? 22. 字符串、列表、元组、字典每个常用的5个方法? 23、 lambda表达式格式以及应用场景? 24. pass的作用 25. *arg和**kwarg作用 26. is和==的区别 27:谈谈Python的深浅拷贝?以及实现方法和应用场景。 28. Python垃圾回收机制? 29.

issue with flask-cors - blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status

☆樱花仙子☆ 提交于 2021-02-17 07:17:31
问题 I'm a newbie in flask and angular please bear with me. I've been stuck with an issue about CORS. I've applied different code fixes just to make it work. Now the error that I am getting is Access to XMLHttpRequest at 'http://localhost:5000/dashboard/clientscount/2019/2020' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status. I think the answer to my problem is from the answered

Flask/Django converting files [closed]

泄露秘密 提交于 2021-02-17 07:06:28
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 days ago . Improve this question I'm trying to build a little converter website. pdf to docx, images to pdf, csv to excel etc... I really want to use node as my static files host server. But as I know node doesn't have that cool modules to handle such convertations. I think of using another server

Flask/Django converting files [closed]

你离开我真会死。 提交于 2021-02-17 07:05:03
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 days ago . Improve this question I'm trying to build a little converter website. pdf to docx, images to pdf, csv to excel etc... I really want to use node as my static files host server. But as I know node doesn't have that cool modules to handle such convertations. I think of using another server

jQuery not recognized in extended html python flask

霸气de小男生 提交于 2021-02-17 05:51:10
问题 Not sure what is going on here. It seems that jQuery is not "extended" from a base.html file to an external one. I have: #base.html <!doctype html> <html class="no-js" lang="en"> <head> ... ... # css imports </head> <body> # some fixed stuff {% block body %} # some stuff specific to base.html {% endblock %} # js imports at the end of the body <script src="static/js/jquery-3.1.0.min.js"></script> ... # various other js </body> </html> Then I have another html file: #test.html {% extends "base

gunicorn or flask printing to console causes internal server error

℡╲_俬逩灬. 提交于 2021-02-17 05:12:36
问题 I have a flask app which I am hosting using the wsgi gunicorn. A while back I found out that having print statements in my code caused my program to throw a 500 internal server error (when I didn't have an SSH connection with the server). I assume this is because since I wasn't connected to the server there was no where to print. However, I now am encountering a bug with a similar nature. I have an python script that will send requests to my web server. When I have an SSH connection with the

bat脚本常用命令

Deadly 提交于 2021-02-17 04:11:20
意气风发啊 骑上我快乐的小摩托 良心公众号啊! 我上墙了 你开始了 嚯嚯嚯嚯嚯 哈哈哈哈哈 皮皮虾我们走 可乐在厨房 红牛在冰箱 6666666 看弹幕,点 关注 " 我相信这不是我一个人的经历:傍晚时分,你坐在屋檐下,看着天慢慢地黑下去,心里寂寞而凄凉,感到自己的生命被剥夺了。当时我是个年轻人,但我害怕这样生活下去,衰老下去。在我看来,这是比死亡更可怕的事。 ——《沉默的大多数》 " title: bat脚本常用命令 date: 2019-11-14 20:23:36 tags: windows script categories: windows script Author:闫玉良 bat 脚本?如果不是从事微软开发相关工作的人员,是不是感觉很耳熟但是又好像不熟悉?还等什么,一睹为快 bat 脚本是 windows 上所用的脚本,我们经常使用的 cmd 一些命令就可以使用。也许你会说为什么不使用 powershell 脚本?因为古老的一些服务器上面没有安装 powershell 你信不信?比如 windows server 2003。 很荣幸,我遇到了,没有什么办法,只能查阅相关资料迎难而上了!脚本其实很简单,下面做一个记录,供大家有需要时获取: 1.设置变量 设置变量使用 SET 关键字,语法如下: SET 变量名=变量值 1. 变量名与变量值一定要紧挨等于号!!!

Docker-Compose

主宰稳场 提交于 2021-02-16 23:15:55
借鉴:https://blog.csdn.net/pushiqiang/article/details/78682323 特点: Compose 是 Docker 容器进行编排的工具,定义和运行多容器的应用,可以一条命令启动多个容器。 技术简介 1、Compose 通过一个配置文件来管理多个Docker容器,在配置文件中,所有的容器通过services来定义 2、使用docker-compose脚本来启动,停止和重启应用,和应用中的服务以及所有依赖服务的容器,非常适合组合使用多个容器进行开发的场景。 3、docker-compose默认的模板文件是 docker-compose.yml,其中定义的每个服务都必须通过 image 指令指定镜像或 build 指令(需要 Dockerfile)来自动构建。其它大部分指令都跟 docker run 中的类似。如果使用 build 指令,在 Dockerfile 中设置的选项(例如:CMD, EXPOSE, VOLUME, ENV 等) 将会自动被获取,无需在 docker-compose.yml 中再次设置。 使用Compose 基本上分为三步: 1.Dockerfile 定义应用的运行环境 2.docker-compose.yml 定义组成应用的各服务 3.docker-compose up 启动整个应用 安装compose yum

How to route non-ascii URLs in Flask python

此生再无相见时 提交于 2021-02-16 22:46:53
问题 Good afternoon, everyone! I have a problem with the routing my URL adress to Flask, precisely with running it in web-browser. All I want is to transfer the sharp symbol "#" and some Russian words (as like " #привет " or " #ПомогитеМнеПожалуйста ") together. The screenshot of error: My programming code at the moment looks like this: # -*- coding: utf-8 -*- from flask import Flask, jsonify app = Flask(__name__) @app.route('/hashtags/' + b'<names>'.decode('utf-8'), methods=['GET']) def get

Object of type 'ndarray' is not JSON serializable

不羁岁月 提交于 2021-02-16 15:50:28
问题 I am new to python and machine learning. I have a Linear Regression model which is able to predict output based on the input which I have dumped to be used with a web service. See the code below: X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25) regression_model = LinearRegression() regression_model.fit(X_train, y_train) print(regression_model.predict(np.array([[21, 0, 0, 0, 1, 0, 0, 1, 1, 1]]))) # this is returning my expected output joblib.dump(regression_model, '..