Python 中from import 用法

1 import
【语法】import tkinter
(1)引用包
import引入的是包中根目录下__init__.py中的全部内容,包括其中的类、类内部的公有属性、类内部的公有方法、方法等内容.(该种方式导入包的本质就是执行__init__.py文件)

(2)引用模块
(该种方式导入模块的本质是将模块解释执行一遍,并赋值给tkinter: module_name = “module_name.py all code”)

 ===>   import module_name —> module_nmae.py —> module_name.py的位置[……]

Read more

python的__init__几种方法总结

1 __init__这个方法一般用于初始化一个类

class Test(object):
    """
    用于初始化类
    """
    def __init__(self, a, b):
        self.a = a
        self.b = b

    def res(self):
        return (self.a, self.b)

t = Test(100, 200)
print t.res()


"""
(100, 200)
"""

2 __str__ 这是一个内置方法, 只能返回字符串,[……]

Read more

VPS Linux 修改MAC地址

Centos 系统修改mac地址后,丢失网关,需要手动设置网关:

ifconfig eth0 down
ifconfig eth0 hw ether 00:00:00:00:00:00
ifconfig eth0 up
route add default gw 192.168.0.1

原因:

网关上arp缓存未过期,需手动清下网关arp或者等待超时自动刷新

Matlab 各版本对应MCR 版本

Release           | Component        | Compiler |

                           | Runtime (MCR) | Version    |

———————————————————–

R14    (7.0)                 | 7.0              | 4.0            |

R14SP1 (7.0.1)         | 7.1              | 4.1            |

[……]

Read more

转动惯量合成注意事项

1 弄清惯性积数据是物理定义的惯性积还是惯性张量的元素值

2 若是物理定义的惯性积,合成时计算质点对新的质心的惯性积取正值

3 若是给定值是惯性张量的元素,合成时计算质点对新的质心的惯性积取负

4 用老质心-新质心 所得XYZ参与计算

linux 添加开机启动命令

/etc/rc.d/rc.local

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this[......]

Read more

边界条件:收口 扭转偏摆 施加

在全局坐标系下施加边界条件:

收口,扩管:

Z轴为中心轴:

X:  A*cos(atan2(Y , X)  or  A*X*sqrt(X^2+Y^2)

Y:  A*sin(atan2(Y , X)  or A*Y*sqrt(X^2+Y^2)

扭转:

 

X: R*cos(atan2(Y,X)+theta)-X

Y: R*sin(atan2(Y,X)+theta)-Y

 

偏摆:

conical(z)
xxx
sqrt(Y*Y+14.3*14.3*cos(atan2(Z,X))*cos(atan2(Z,X)))*cos(0.017[……]

Read more

橡胶有限元分析

Elastomers are materials such as natural and synthetic rubbers that can undergo large elastic deformations of 100-700%, typically have highly nonlinear stress-strain behavior, and are nearly incompressible.  All of these features can cause headaches with your finite element analysis convergence, but[……]

Read more