How to use jupyter nbconvert

How to use jupyter nbconvert

最近在使用jupyter notebook的时候,发现notebook文件在问题探索方面非常方便,但是交付的话,还是期望能将其转换为python源文件。要实现notebook源文件(.ipynb)与python源文件(.py)之间的相互转换,可以使用命令jupyter nbconvert来完成。举例如下,

这里有一个文件名称为,内容如下:

lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$ cat Chap14.ipynb 
{"cells": [{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["from pyalink.alink import *\n","useLocalEnv(1)\n","\n","from utils import *\n","import os\n","import pandas as pd\n","\n","pd.set_option('display.max_colwidth', 1000)\n","\n","DATA_DIR = ROOT_DIR + \"ctr_avazu\" + os.sep\n","\n","SCHEMA_STRING\\\n","    = \"id string, click string, dt string, C1 string, banner_pos int, site_id string, site_domain string, \"\\\n","    + \"site_category string, app_id string, app_domain string, app_category string, device_id string, \"\\\n","    + \"device_ip string, device_model string, device_type string, device_conn_type string, C14 int, C15 int, \"\\\n","    + \"C16 int, C17 int, C18 int, C19 int, C20 int, C21 int\"\n","\n","CATEGORY_COL_NAMES = [\n","    \"C1\", \"banner_pos\", \"site_category\", \"app_domain\",\n","    \"app_category\", \"device_type\", \"device_conn_type\",\n","    \"site_id\", \"site_domain\", \"device_id\", \"device_model\"\n","]\n","\n","NUMERICAL_COL_NAMES = [\"C14\", \"C15\", \"C16\", \"C17\", \"C18\", \"C19\", \"C20\", \"C21\"]\n","\n","FEATURE_MODEL_FILE = \"feature_model.ak\"\n","INIT_MODEL_FILE = \"init_model.ak\"\n","\n","LABEL_COL_NAME = \"click\"\n","VEC_COL_NAME = \"vec\"\n","PREDICTION_COL_NAME = \"pred\"\n","PRED_DETAIL_COL_NAME = \"pred_info\"\n","\n","NUM_HASH_FEATURES = 30000\n"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["#c_2\n","TextSourceBatchOp()\\\n","    .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                 + \"data-files/avazu-small.csv\")\\\n","    .firstN(10)\\\n","    .print()\n","\n","trainBatchData = CsvSourceBatchOp()\\\n","    .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                 + \"data-files/avazu-small.csv\")\\\n","    .setSchemaStr(SCHEMA_STRING);\n","\n","trainBatchData.firstN(10).print();\n"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["#c_3\n","trainBatchData = CsvSourceBatchOp()\\\n","    .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                 + \"data-files/avazu-small.csv\")\\\n","    .setSchemaStr(SCHEMA_STRING);\n","\n","feature_pipeline = Pipeline()\\\n","    .add(\n","        StandardScaler()\\\n","            .setSelectedCols(NUMERICAL_COL_NAMES)\n","    )\\\n","    .add(\n","        FeatureHasher()\\\n","            .setSelectedCols(CATEGORY_COL_NAMES + NUMERICAL_COL_NAMES)\\\n","            .setCategoricalCols(CATEGORY_COL_NAMES)\\\n","            .setOutputCol(VEC_COL_NAME)\\\n","            .setNumFeatures(NUM_HASH_FEATURES)\n","    );\n","\n","if not(os.path.exists(DATA_DIR + FEATURE_MODEL_FILE)) :\n","    feature_pipeline\\\n","        .fit(trainBatchData)\\\n","        .save(DATA_DIR + FEATURE_MODEL_FILE)\n","    BatchOperator.execute()\n"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["#c_4\n","feature_pipelineModel = PipelineModel.load(DATA_DIR + FEATURE_MODEL_FILE)\n","\n","data = CsvSourceStreamOp()\\\n","    .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                 + \"data-files/avazu-ctr-train-8M.csv\")\\\n","    .setSchemaStr(SCHEMA_STRING);\n","\n","if not(os.path.exists(DATA_DIR + INIT_MODEL_FILE)) :\n","    trainBatchData = CsvSourceBatchOp()\\\n","        .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                     + \"data-files/avazu-small.csv\")\\\n","        .setSchemaStr(SCHEMA_STRING);\n","\n","    lr = LogisticRegressionTrainBatchOp()\\\n","        .setVectorCol(VEC_COL_NAME)\\\n","        .setLabelCol(LABEL_COL_NAME)\\\n","        .setWithIntercept(True)\\\n","        .setMaxIter(10);\n","\n","    feature_pipelineModel\\\n","    .transform(trainBatchData)\\\n","    .link(lr)\\\n","    .link(\n","        AkSinkBatchOp().setFilePath(DATA_DIR + INIT_MODEL_FILE)\n","    );\n","    BatchOperator.execute();\n"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["#c_5 \n","feature_pipelineModel = PipelineModel.load(DATA_DIR + FEATURE_MODEL_FILE);\n","\n","initModel = AkSourceBatchOp().setFilePath(DATA_DIR + INIT_MODEL_FILE);\n","\n","data = CsvSourceStreamOp()\\\n","    .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                 + \"data-files/avazu-ctr-train-8M.csv\")\\\n","    .setSchemaStr(SCHEMA_STRING)\\\n","    .setIgnoreFirstLine(True)\n","\n","spliter = SplitStreamOp().setFraction(0.5).linkFrom(data);\n","train_stream_data = feature_pipelineModel.transform(spliter);\n","test_stream_data = feature_pipelineModel.transform(spliter.getSideOutput(0));\n","\n","model = FtrlTrainStreamOp(initModel)\\\n","    .setVectorCol(VEC_COL_NAME)\\\n","    .setLabelCol(LABEL_COL_NAME)\\\n","    .setWithIntercept(True)\\\n","    .setAlpha(0.1)\\\n","    .setBeta(0.1)\\\n","    .setL1(0.01)\\\n","    .setL2(0.01)\\\n","    .setTimeInterval(10)\\\n","    .setVectorSize(NUM_HASH_FEATURES)\\\n","    .linkFrom(train_stream_data);\n","\n","predResult = FtrlPredictStreamOp(initModel)\\\n","    .setVectorCol(VEC_COL_NAME)\\\n","    .setPredictionCol(PREDICTION_COL_NAME)\\\n","    .setReservedCols([LABEL_COL_NAME])\\\n","    .setPredictionDetailCol(PRED_DETAIL_COL_NAME)\\\n","    .linkFrom(model, test_stream_data);\n","\n","# predResult\\\n","#     .sample(0.0001)\\\n","#     .select(\"'Pred Sample' AS out_type, *\")\\\n","#     .print();\n","\n","predResult.print(key=\"predResult\", refreshInterval = 30, maxLimit=20)"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["predResult\\\n","    .link(\n","        EvalBinaryClassStreamOp()\\\n","            .setLabelCol(LABEL_COL_NAME)\\\n","            .setPredictionDetailCol(PRED_DETAIL_COL_NAME)\\\n","            .setTimeInterval(10)\n","    )\\\n","    .link(\n","        JsonValueStreamOp()\\\n","            .setSelectedCol(\"Data\")\\\n","            .setReservedCols([\"Statistics\"])\\\n","            .setOutputCols([\"Accuracy\", \"AUC\", \"ConfusionMatrix\"])\\\n","            .setJsonPath([\"$.Accuracy\", \"$.AUC\", \"$.ConfusionMatrix\"])\n","    )\\\n","    .print(key=\"evaluation\", refreshInterval = 30, maxLimit=20)\n","# .select(\"'Eval Metric' AS out_type, *\")\\\n","#     .print();\n","\n","StreamOperator.execute();\n"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": ["#c_6\n","data = CsvSourceStreamOp()\\\n","    .setFilePath(\"http://alink-release.oss-cn-beijing.aliyuncs.com/\"\n","                 + \"data-files/avazu-ctr-train-8M.csv\")\\\n","    .setSchemaStr(SCHEMA_STRING)\\\n","    .setIgnoreFirstLine(True);\n","\n","feature_pipelineModel = PipelineModel.load(DATA_DIR + FEATURE_MODEL_FILE);\n","\n","spliter = SplitStreamOp().setFraction(0.5).linkFrom(data);\n","train_stream_data = feature_pipelineModel.transform(spliter);\n","test_stream_data = feature_pipelineModel.transform(spliter.getSideOutput(0));\n","\n","initModel = AkSourceBatchOp().setFilePath(DATA_DIR + INIT_MODEL_FILE);\n","\n","model = FtrlTrainStreamOp(initModel)\\\n","    .setVectorCol(VEC_COL_NAME)\\\n","    .setLabelCol(LABEL_COL_NAME)\\\n","    .setWithIntercept(True)\\\n","    .setAlpha(0.1)\\\n","    .setBeta(0.1)\\\n","    .setL1(0.01)\\\n","    .setL2(0.01)\\\n","    .setTimeInterval(10)\\\n","    .setVectorSize(NUM_HASH_FEATURES)\\\n","    .linkFrom(train_stream_data);\n","\n","model_filter = FtrlModelFilterStreamOp()\\\n","    .setPositiveLabelValueString(\"1\")\\\n","    .setVectorCol(VEC_COL_NAME)\\\n","    .setLabelCol(LABEL_COL_NAME)\\\n","    .setAccuracyThreshold(0.83)\\\n","    .setAucThreshold(0.71)\\\n","    .linkFrom(model, train_stream_data);\n","\n","model_filter\\\n","    .select(\"'Model' AS out_type, *\")\\\n","    .print();\n","\n","predResult = FtrlPredictStreamOp(initModel)\\\n","    .setVectorCol(VEC_COL_NAME)\\\n","    .setPredictionCol(PREDICTION_COL_NAME)\\\n","    .setReservedCols([LABEL_COL_NAME])\\\n","    .setPredictionDetailCol(PRED_DETAIL_COL_NAME)\\\n","    .linkFrom(model_filter, test_stream_data);\n","\n","predResult\\\n","    .sample(0.0001)\\\n","    .select(\"'Pred Sample' AS out_type, *\")\\\n","    .print();\n","\n","predResult\\\n","    .link(\n","        EvalBinaryClassStreamOp()\\\n","            .setPositiveLabelValueString(\"1\")\\\n","            .setLabelCol(LABEL_COL_NAME)\\\n","            .setPredictionDetailCol(PRED_DETAIL_COL_NAME)\\\n","            .setTimeInterval(10)\n","    )\\\n","    .link(\n","        JsonValueStreamOp()\\\n","            .setSelectedCol(\"Data\")\\\n","            .setReservedCols([\"Statistics\"])\\\n","            .setOutputCols([\"Accuracy\", \"AUC\", \"ConfusionMatrix\"])\\\n","            .setJsonPath([\"$.Accuracy\", \"$.AUC\", \"$.ConfusionMatrix\"])\n","    )\\\n","    .select(\"'Eval Metric' AS out_type, *\")\\\n","    .print();\n","\n","StreamOperator.execute();\n"]},{"cell_type": "code","execution_count": null,"metadata": {},"outputs": [],"source": []}],"metadata": {"kernelspec": {"display_name": "Python 3","language": "python","name": "python3"},"language_info": {"codemirror_mode": {"name": "ipython","version": 3},"file_extension": ".py","mimetype": "text/x-python","name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython3","version": "3.8.8"}},"nbformat": 4,"nbformat_minor": 4
}
(lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$ 

接下来,我们借助命令jupyter nbconvert将其转换为.py文件,命令如下:

(lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$ mkdir -p python
(lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$ jupyter nbconvert --to python Chap14.ipynb --output-dir python
[NbConvertApp] Converting notebook Chap14.ipynb to python
[NbConvertApp] Writing 7347 bytes to python/Chap14.py
(lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$

我们看到,已经在python目录下生成了文件Chap14.py。

接下来,我们看一下生成的Chap14.py文件的内容:

(lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$ cat python/Chap14.py 
#!/usr/bin/env python
# coding: utf-8# In[ ]:from pyalink.alink import *
useLocalEnv(1)from utils import *
import os
import pandas as pdpd.set_option('display.max_colwidth', 1000)DATA_DIR = ROOT_DIR + "ctr_avazu" + os.sepSCHEMA_STRING\= "id string, click string, dt string, C1 string, banner_pos int, site_id string, site_domain string, "\+ "site_category string, app_id string, app_domain string, app_category string, device_id string, "\+ "device_ip string, device_model string, device_type string, device_conn_type string, C14 int, C15 int, "\+ "C16 int, C17 int, C18 int, C19 int, C20 int, C21 int"CATEGORY_COL_NAMES = ["C1", "banner_pos", "site_category", "app_domain","app_category", "device_type", "device_conn_type","site_id", "site_domain", "device_id", "device_model"
]NUMERICAL_COL_NAMES = ["C14", "C15", "C16", "C17", "C18", "C19", "C20", "C21"]FEATURE_MODEL_FILE = "feature_model.ak"
INIT_MODEL_FILE = "init_model.ak"LABEL_COL_NAME = "click"
VEC_COL_NAME = "vec"
PREDICTION_COL_NAME = "pred"
PRED_DETAIL_COL_NAME = "pred_info"NUM_HASH_FEATURES = 30000# In[ ]:#c_2
TextSourceBatchOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-small.csv")\.firstN(10)\.print()trainBatchData = CsvSourceBatchOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-small.csv")\.setSchemaStr(SCHEMA_STRING);trainBatchData.firstN(10).print();# In[ ]:#c_3
trainBatchData = CsvSourceBatchOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-small.csv")\.setSchemaStr(SCHEMA_STRING);feature_pipeline = Pipeline()\.add(StandardScaler()\.setSelectedCols(NUMERICAL_COL_NAMES))\.add(FeatureHasher()\.setSelectedCols(CATEGORY_COL_NAMES + NUMERICAL_COL_NAMES)\.setCategoricalCols(CATEGORY_COL_NAMES)\.setOutputCol(VEC_COL_NAME)\.setNumFeatures(NUM_HASH_FEATURES));if not(os.path.exists(DATA_DIR + FEATURE_MODEL_FILE)) :feature_pipeline\.fit(trainBatchData)\.save(DATA_DIR + FEATURE_MODEL_FILE)BatchOperator.execute()# In[ ]:#c_4
feature_pipelineModel = PipelineModel.load(DATA_DIR + FEATURE_MODEL_FILE)data = CsvSourceStreamOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-ctr-train-8M.csv")\.setSchemaStr(SCHEMA_STRING);if not(os.path.exists(DATA_DIR + INIT_MODEL_FILE)) :trainBatchData = CsvSourceBatchOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-small.csv")\.setSchemaStr(SCHEMA_STRING);lr = LogisticRegressionTrainBatchOp()\.setVectorCol(VEC_COL_NAME)\.setLabelCol(LABEL_COL_NAME)\.setWithIntercept(True)\.setMaxIter(10);feature_pipelineModel\.transform(trainBatchData)\.link(lr)\.link(AkSinkBatchOp().setFilePath(DATA_DIR + INIT_MODEL_FILE));BatchOperator.execute();# In[ ]:#c_5 
feature_pipelineModel = PipelineModel.load(DATA_DIR + FEATURE_MODEL_FILE);initModel = AkSourceBatchOp().setFilePath(DATA_DIR + INIT_MODEL_FILE);data = CsvSourceStreamOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-ctr-train-8M.csv")\.setSchemaStr(SCHEMA_STRING)\.setIgnoreFirstLine(True)spliter = SplitStreamOp().setFraction(0.5).linkFrom(data);
train_stream_data = feature_pipelineModel.transform(spliter);
test_stream_data = feature_pipelineModel.transform(spliter.getSideOutput(0));model = FtrlTrainStreamOp(initModel)\.setVectorCol(VEC_COL_NAME)\.setLabelCol(LABEL_COL_NAME)\.setWithIntercept(True)\.setAlpha(0.1)\.setBeta(0.1)\.setL1(0.01)\.setL2(0.01)\.setTimeInterval(10)\.setVectorSize(NUM_HASH_FEATURES)\.linkFrom(train_stream_data);predResult = FtrlPredictStreamOp(initModel)\.setVectorCol(VEC_COL_NAME)\.setPredictionCol(PREDICTION_COL_NAME)\.setReservedCols([LABEL_COL_NAME])\.setPredictionDetailCol(PRED_DETAIL_COL_NAME)\.linkFrom(model, test_stream_data);# predResult\
#     .sample(0.0001)\
#     .select("'Pred Sample' AS out_type, *")\
#     .print();predResult.print(key="predResult", refreshInterval = 30, maxLimit=20)# In[ ]:predResult\.link(EvalBinaryClassStreamOp()\.setLabelCol(LABEL_COL_NAME)\.setPredictionDetailCol(PRED_DETAIL_COL_NAME)\.setTimeInterval(10))\.link(JsonValueStreamOp()\.setSelectedCol("Data")\.setReservedCols(["Statistics"])\.setOutputCols(["Accuracy", "AUC", "ConfusionMatrix"])\.setJsonPath(["$.Accuracy", "$.AUC", "$.ConfusionMatrix"]))\.print(key="evaluation", refreshInterval = 30, maxLimit=20)
# .select("'Eval Metric' AS out_type, *")\
#     .print();StreamOperator.execute();# In[ ]:#c_6
data = CsvSourceStreamOp()\.setFilePath("http://alink-release.oss-cn-beijing.aliyuncs.com/"+ "data-files/avazu-ctr-train-8M.csv")\.setSchemaStr(SCHEMA_STRING)\.setIgnoreFirstLine(True);feature_pipelineModel = PipelineModel.load(DATA_DIR + FEATURE_MODEL_FILE);spliter = SplitStreamOp().setFraction(0.5).linkFrom(data);
train_stream_data = feature_pipelineModel.transform(spliter);
test_stream_data = feature_pipelineModel.transform(spliter.getSideOutput(0));initModel = AkSourceBatchOp().setFilePath(DATA_DIR + INIT_MODEL_FILE);model = FtrlTrainStreamOp(initModel)\.setVectorCol(VEC_COL_NAME)\.setLabelCol(LABEL_COL_NAME)\.setWithIntercept(True)\.setAlpha(0.1)\.setBeta(0.1)\.setL1(0.01)\.setL2(0.01)\.setTimeInterval(10)\.setVectorSize(NUM_HASH_FEATURES)\.linkFrom(train_stream_data);model_filter = FtrlModelFilterStreamOp()\.setPositiveLabelValueString("1")\.setVectorCol(VEC_COL_NAME)\.setLabelCol(LABEL_COL_NAME)\.setAccuracyThreshold(0.83)\.setAucThreshold(0.71)\.linkFrom(model, train_stream_data);model_filter\.select("'Model' AS out_type, *")\.print();predResult = FtrlPredictStreamOp(initModel)\.setVectorCol(VEC_COL_NAME)\.setPredictionCol(PREDICTION_COL_NAME)\.setReservedCols([LABEL_COL_NAME])\.setPredictionDetailCol(PRED_DETAIL_COL_NAME)\.linkFrom(model_filter, test_stream_data);predResult\.sample(0.0001)\.select("'Pred Sample' AS out_type, *")\.print();predResult\.link(EvalBinaryClassStreamOp()\.setPositiveLabelValueString("1")\.setLabelCol(LABEL_COL_NAME)\.setPredictionDetailCol(PRED_DETAIL_COL_NAME)\.setTimeInterval(10))\.link(JsonValueStreamOp()\.setSelectedCol("Data")\.setReservedCols(["Statistics"])\.setOutputCols(["Accuracy", "AUC", "ConfusionMatrix"])\.setJsonPath(["$.Accuracy", "$.AUC", "$.ConfusionMatrix"]))\.select("'Eval Metric' AS out_type, *")\.print();StreamOperator.execute();# In[ ]:(lanzhou) lwk@qwfys:~/Public/project/python/alink_tutorial_python/pyalink$ 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/778920.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Mybatis中QueryWrapper的复杂查询SQL

最近在使用QueryWrapper编写查询语句时发现复杂的SQL不会写。在网上找了半天,终于得到了点启示。在此做个记录以备忘。 我要实现的SQL是这样的: -- 实现这个复杂查询 -- 查询设备表 select * from oa_device where ((dev_code BSD1003 and dev_status…

[flume$1]记录一个启动flume配置的错误

先总结:Flume配置文件后面,不能跟注释 报错代码: [ERROR - org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:158)] Unable to deliver event. Exception follows. org.apache.flume.EventDeliveryException: Failed to open…

Termius for Mac/Win:多协议远程管理利器,你的工作效率提升神器

在数字化飞速发展的今天,远程管理已成为企业运营和个人工作不可或缺的一部分。而Termius,作为一款多协议远程管理软件,正以其卓越的性能和便捷的操作,成为广大用户的心头好。 Termius支持多种协议,无论是SSH、RDP还是…

使用VSCode搭建Vue 3开发环境

使用VSCode搭建Vue 3开发环境 Vue 3是一种流行的前端JavaScript框架,它提供了响应式的数据绑定和组合式的API。Visual Studio Code(VSCode)是一个轻量级但功能强大的源代码编辑器,支持多种语言开发。本文将引导您完成使用VSCode搭建Vue 3开发环境的步骤。 1. 下载和安装V…

构建docker环境下的thunder迅雷插件

前言 从迅雷群晖套件中提取出来用于其他设备的迅雷远程下载服务程序。仅供测试,测试完请大家自觉删除。 下载保存目录 /xunlei/downloads, 对应迅雷应用内显示的下载路径是 /downloads 或者 /迅雷下载 仓库 阿里云镜像(国内访问&#xff…

查询优化-提升子查询-UNION类型

瀚高数据库 目录 文档用途 详细信息 文档用途 剖析UNION类型子查询提升的条件和过程 详细信息 注:图片较大,可在浏览器新标签页打开。 SQL: SELECT * FROM score sc, LATERAL(SELECT * FROM student WHERE sno 1 UNION ALL SELECT * FROM student…

leeetcode热题100.每日温度

作者:晓宜 🌈🌈🌈 个人简介:互联网大厂Java准入职,阿里云专家博主,csdn后端优质创作者,算法爱好者 🌙🌙🌙 分享单调栈的用法,有顺序和…

linux debian运行pip报错ssl tsl module in Python is not available

写在前面 ① 在debian 8上升级了Python 3.8.5 ② 升级了openssl 1.1.1 问题描述 在运行pip命令时提示如下错误 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.尝试了大神推荐的用如下方法重新编译安装python,发…

企业微信知识库:从了解到搭建的全流程

你是否也有这样的疑惑:为什么现在的企业都爱创建企业微信知识库?企业微信知识库到底有什么用?如果想要使用企业微信知识库企业应该如何创建?这就是我今天要探讨的问题,感兴趣的话一起往下看吧! | 为什么企业…

网站业务对接DDoS高防

准备需要接入的网站域名清单,包含网站的源站服务器IP(仅支持公网IP的防护)、端口信息等。所接入的网站域名必须已完成ICP备案。如果您的网站支持HTTPS协议访问,您需要准备相应的证书和私钥信息,一般包含格式为.crt的公…

游戏赛道新机会:善用数据分析,把握游戏赛道广告变现良机 | TOPON变现干货

12月10日,由罗斯基联合TopOn、钛动科技共同主办的《游戏赛道新机会》主题系列沙龙在武汉举办。活动邀请了国内外多家业内知名公司的负责人到场分享,现场嘉宾分别从自己擅长的领域出发,通过数据分析,案例复盘等多个维度方向进行讲解…

C++超市商品管理系统

一、简要介绍 1.本项目为面向对象程序设计的大作业,基于Qt creator进行开发,Qt框架版本6.4.1,编译环境MINGW 11.2.0。 2.项目结构简介:关于系统逻辑部分的代码的头文件在head文件夹中,源文件在s文件夹中。与图形界面…

JavaScript代理模式之四大代理

JavaScript设计模式中有一种模式为代理模式 事件代理 事件代理是代理中最常见的一种,也是一道实打实的高频面试题,它的场景是一个父元素下有多个子元素。 考虑到事务具有冒泡性,当我们点击a标签的时候,会冒泡到父级。从而被监听…

基于Java仓库管理系统设计与实现(源码+部署文档+论文)

博主介绍: ✌至今服务客户已经1000、专注于Java技术领域、项目定制、技术答疑、开发工具、毕业项目实战 ✌ 🍅 文末获取源码联系 🍅 👇🏻 精彩专栏 推荐订阅 👇🏻 不然下次找不到 Java项目精品实…

Vue 获取当前页面URL和进行页面重定向

前言 在Vue开发中,有时候我们需要获取当前页面的URL或者进行页面重定向。本文将介绍如何使用window.location对象来获取当前页面的URL以及常用的重定向方法。 window.location的详解 window.location对象提供了许多属性,可以用于获取当前页面的URL的不同部分。下面是一些常…

剑指Offer题目笔记20(在数组范围内二分查找)

面试题72: 问题: ​ 输入一个非负整数,计算它的平方根。 解决方案: 使用二分查找。一个数x的平方根一定小于或等于x,同时,除了0之外的所有非负整数的平方根都大于等于1,故该数的平方根在1到x…

Python数据库编程全指南SQLite和MySQL实践

1. 安装必要的库 首先,我们需要安装Python的数据库驱动程序,以便与SQLite和MySQL进行交互。对于SQLite,Python自带了支持;而对于MySQL,我们需要安装额外的库,如mysql-connector-python。 # 安装 MySQL 连接…

数据库中的约束纯干货——主键约束

目录 (一)特点: (二)添加主键约束 2.1格式: 2.2举例: 2.3建立表级约束: 2.4建立表后增加主键约束 (三)复合主键 3.1格式: 3.2举例&#…

每日一题 --- 快乐数[力扣][Go]

快乐数 题目:202. 快乐数 编写一个算法来判断一个数 n 是不是快乐数。 「快乐数」 定义为: 对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和。然后重复这个过程直到这个数变为 1,也可能是 无限循环 但始终变不到…

Golang- 邮件服务,发送邮件

依赖 go get -u github.com/jordan-wright/email文档 文档 示例代码 package utilimport ("ToDoList/global""crypto/tls""fmt""github.com/jordan-wright/email""net/smtp" ) /* 配置 email:port: 465from: xxxqq.comh…