随笔分类 - [32] Python
摘要:安装相关的库 1)CMD窗口,切换到python编译器所在的路径 假设使用的python.exe为 E:\Eprogramfiles\Anaconda3\envs\myenvpy38\python.exe cd E:\Eprogramfiles\Anaconda3\envs\myenvpy38\Sc
阅读全文
摘要:Tkinter 支持将很多 GUI 组件与变量进行双向绑定,执行这种双向绑定后编程非常方便: 如果程序改变变量的值,GUI 组件的显示内容或值会随之改变。 当 GUI 组件的内容发生改变时(比如用户输入),变量的值也会随之改变。 为了让 Tkinter 组件与变量进行双向绑定,只要为这些组件指定 v
阅读全文
摘要:因为Flask2.0中已经移除了_compat这个模块,导入直接就报错,那么很简单只要flask_script模块进行维护更新就可以了,很不幸的是,flask_script库已经4年多没有进行更新了,而且该作者也在issue上表示过不再对这个库后续进行维护,意思是要抛弃了,后来我找了下资料,原因大概
阅读全文
摘要:Python 3 - Mock Test IV Q 1 - Which of the following function removes all leading and trailing whitespace in string? A - replace(old, new [, max]) B -
阅读全文
摘要:Python 3 - Mock Test III Q 1 - Which of the following operator in python evaluates to true if it does not finds a variable in the specified sequence a
阅读全文
摘要:Python 3 - Mock Test II Q 1 - What is the output of print tuple[2:] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )? A - ( 'abcd', 786 , 2.23, 'john',
阅读全文
摘要:Python 3 - Mock Test I Q 1 - Which of the following is correct about Python? A - Python is a high-level, interpreted, interactive and object-oriented
阅读全文
摘要:What is Python? Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It
阅读全文
摘要:Turtle is a special feathers of Python. Using Turtle, we can easily draw in a drawing board. First we import the turtle module. Then create a window,
阅读全文
摘要:Python provides various options for developing graphical user interfaces (GUIs). The most important features are listed below. Tkinter − Tkinter is th
阅读全文
摘要:Mathematically a set is a collection of items not in any particular order. A Python set is similar to this mathematical definition with below addition
阅读全文
摘要:01 Python 3 - Tutorial 02 Python 3 - Overview 03 Python 3 - Environment Setup 04 Python 3 - Basic Syntax 05 Python 3 - Variable Types 06 Python 3 - Ba
阅读全文
摘要:Memory Alignment NumPy alignment goals There are three use-cases related to memory alignment in NumPy (as of 1.14): Creating structured datatypes with
阅读全文
摘要:实例⽅法 定义:第⼀个参数必须是实例对象,该参数名⼀般约定为“self”,通过它来传递实例的属性和⽅法(也可以传类的属性和⽅法); 调⽤:只能由实例对象调⽤。类⽅法 定义:使⽤装饰器@classmethod。第⼀个参数必须是当前类对象,该参数名⼀般约定为“cls”,通过它来传递类的属性和⽅法(不能传
阅读全文
摘要:数组元素的添加与删除 函数元素及描述 resize 返回指定形状的新数组 append 将值添加到数组末尾 insert 沿指定轴将值插入到指定下标之前 delete 删掉某个轴的子数组,并返回删除后的新数组 unique 查找数组内的唯一元素 numpy.resize numpy.resize 函
阅读全文
摘要:分割数组 函数数组及操作 split 将一个数组分割为多个子数组 hsplit 将一个数组水平分割为多个子数组(按列) vsplit 将一个数组垂直分割为多个子数组(按行) numpy.split numpy.split 函数沿特定的轴将数组分割为子数组,格式如下: numpy.split(ary,
阅读全文
摘要:连接数组 函数描述 concatenate 连接沿现有轴的数组序列 stack 沿着新的轴加入一系列数组。 hstack 水平堆叠序列中的数组(列方向) vstack 竖直堆叠序列中的数组(行方向) numpy.concatenate numpy.concatenate 函数用于沿指定轴连接相同形状
阅读全文
摘要:修改数组维度 维度描述 broadcast 产生模仿广播的对象 broadcast_to 将数组广播到新形状 expand_dims 扩展数组的形状 squeeze 从数组的形状中删除一维条目 numpy.broadcast numpy.broadcast 用于模仿广播的对象,它返回一个对象,该对象
阅读全文
摘要:翻转数组 函数描述 transpose 对换数组的维度;转置 ndarray.T 和 self.transpose() 相同;转置 rollaxis 向后滚动指定的轴 swapaxes 对换数组的两个轴 numpy.transpose numpy.transpose 函数用于转置,格式如下: num
阅读全文
摘要:Python 全局变量 global Python 3 assert(断言) Python is 与 == 区别 在 Python 中一切都是对象,对象之间比较是否相等可以用==,也可以用is。==和is操作的区别是: is 比较的是两个对象的id值是否相等,也就是比较俩对象是否为同一个实例对象,是
阅读全文