![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python入坑
文章平均质量分 69
J.Tabibito
这个作者很懒,什么都没留下…
展开
-
python虚拟环境
一、使用virtualenv 1. 使用pip pip install virtualenv 2. 创建运行环境 virtualenv [虚拟环境名称] virtualenv venv #如果不想使用系统的包,加上–no-site-packeages参数 virtualenv --no-site-packages 创建路径名 3. 激活环境 linux: $ cd venv $ source ./bin/activate Windows 10: > cd venv &g原创 2021-05-16 15:05:47 · 143 阅读 · 2 评论 -
C/C++调用Python模块
近期需要将Python作为模块对项目进行嵌入式开发,但是发现python想要使用C/C++的导出模块必须要用Cython或者是DLL,开发效率并不如LUA脚本开发,所以在此记录下如何利用C/C++调用Python模块。 首先配置环境,在项目中加入Python不同版本自带的include和libs,然后再导入使用的Python版本的DLL文件。 #include <stdio.h>...原创 2018-11-26 21:25:32 · 607 阅读 · 0 评论 -
Python3 类
# 1、SchoolMem类,该类中包含三种属性 class SchoolMem : def __init__(self, name, sex, age) : self.__name = name self.__sex = sex self.__age = age def get_name(self) : ...原创 2018-11-15 15:37:30 · 606 阅读 · 0 评论 -
Python3练习
乘法口诀表 for i in range(1, 10) : for j in range(1, i + 1) : print("{}*{}={}\t".format(i, j, i*j), end='') print() 1-20的阶乘 def Mutiplication(num) : if num == 0 : return 1 ...原创 2018-10-17 16:28:04 · 114 阅读 · 0 评论 -
Python3练习
1.程序实现打印第一个三位的水仙花数。 import math print("第一个水仙花数:") for narNum in range(100, 999) : if((pow(narNum % 10, 3) + pow(int((narNum / 10) % 10), 3) + pow(int(narNum / 100), 3)) == narNum) : prin...原创 2018-10-17 16:22:57 · 795 阅读 · 0 评论 -
Python3练习
打印1-100内所有素数 from random import randint def FindAllPrime(end) : for idx in range(2, end + 1) : for idx_2 in range(2, int(idx/2) + 1) : if(idx % idx_2 == 0) : ...原创 2018-10-17 16:17:16 · 121 阅读 · 0 评论