本文适合有 Python 基础的小伙伴进阶学习 作者:pwwang 一、前言 本文基于开源项目: https://github.com/pwwang/python-import-system 补充扩展讲解,希望能够让读者一文搞懂 Python 的 import 机制。 1.1 什么是 import ...
分类:
编程语言 时间:
2021-02-08 12:10:31
阅读次数:
0
Python是没有swithch语句, 这点还是对于我们这些整Java/C/Shell/... 人都是很不习惯, 你得这样才行! #!/usr/bin/env python2 junk = "shoo2" def shoo_fun1(): print "hello ok1" def shoo_fun ...
分类:
编程语言 时间:
2021-02-08 12:09:39
阅读次数:
0
通过python可以调用smtp第三方邮件服务接口,这使得我们可以通过python直接来发送邮件。在这个功能基础上,我们可以结合Linux的定时任务服务Crontab,来开发一些有意思的项目,比如爬虫等。这里我们就只简单演示一个定时播报随机数的任务示例,很好的结合了crontab定时任务、pytho... ...
分类:
编程语言 时间:
2021-02-08 12:06:32
阅读次数:
0
参考来源:Magnus Lie Hetland 《Python基础教程》 1. 自定义函数 def hello( name ): return 'Hello, ' + name + '!' 可以判断一个对象是不是函数: callable( hello ) 如果是函数,就会返回True,否则会返回Fa ...
分类:
编程语言 时间:
2021-02-08 12:06:02
阅读次数:
0
默认centos, unbtan都已经安装了python3版本,可以通过 whereis python来检查已经安装的版本。 root@hecs-x-medium-2-linux-20200619090653:/usr/bin# whereis pythonpython: /usr/bin/pyth ...
分类:
编程语言 时间:
2021-02-08 12:04:26
阅读次数:
0
不懂原理的同学请参考: https://blog.csdn.net/qq_43337858/article/details/102738352?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPa ...
分类:
编程语言 时间:
2021-02-08 11:52:03
阅读次数:
0
类的创建 语法 class 类名: pass 类名由一个或多个字母组成,首字母大写,其他字母小写。 直接写在类里的变量,成为类属性。 在类里定义的函数,成为类方法。 class Student: name = '张三' # 类属性 def eat(self): # 实例方法 print(self.n ...
分类:
编程语言 时间:
2021-02-08 11:44:26
阅读次数:
0
我错误的原因 一开始误将数据表通过 navicat 删除了,导致了这个错误的出现 解决方法: 在终端输入 python manage.py migrate --fake 然后进行迁移即可(注:数据需要重新录入) python manage.py migrate 2021-02-05 ...
分类:
数据库 时间:
2021-02-06 11:58:25
阅读次数:
0
''' @Author: feizzhang Created on: 02.02.2021 ''' def split_img_to_anypieces(img_path, output_dir, ratio_w = 2, ratio_h = 2): ''' Args: img_path: the ...
分类:
编程语言 时间:
2021-02-06 11:51:02
阅读次数:
0
1、 Python Web实战:Python+Django+MySQL实现基于Web版的增删改查 https://blog.csdn.net/u013737132/article/details/106037696/?utm_medium=distribute.pc_relevant_downloa ...
分类:
数据库 时间:
2021-02-06 11:49:51
阅读次数:
0