Python学习笔记

@ zip(iter1 [,iter2 [...]]),      *

一个功能类,接收一些列可迭代的序列作为参数,子函数 .__next__() 可以返回一个tuple,若传入参数的长度不等,则返回list的长度和参数中长度最短的对象相同。外面套一层list()或者dict()可以将所有的结果tuple变成list或者dict,  *: 可以看做是其反过程

a1 = [1,2,3]
a2 = [4,5,6]
a3 = [7,8,9,10]
result = list(zip(a1,a2,a3))
print(result)
结果:[(1, 4, 7), (2, 5, 8), (3, 6, 9)]

print(list(zip(*result)))
结果:[(1, 2, 3), (4, 5, 6), (7, 8, 9)]

================================================================

@ '' // '': 整数除法

print(7//3)
结果: 2

================================================================

@ 运算符"**"
代表乘方,2 ** 3 = 8

===============================================================

@ Anaconda Environment

When you create conda environments, you create physical directories that isolate the specific Python interpreter and packages you install into the environment. This allows you to create multiple environments that can have different versions of software, including Python. You can easily create new environments and then switch between them without affecting other environments. For detailed explanation and instructions, see the conda documentation on Managingenvironments.

=================================================================

@ python assert断言的使用

python中简单的异常使用方法,当assert后面的判断是为True是,引发异常,可以理解为:if true rarse

for i in range(10):
    print(i)
    assert i != 3
输出结果为:

0
1
2
3
Traceback (most recent call last):
  File "D:/Users/humeng/PycharmProjects/rnn-nlu/test.py", line 18, in 
    assert i != 5
AssertionError

@ Anaconda安装python,加入到系统环境变量中

D:\Users\humeng\AppData\Local\Continuum\anaconda3\Scripts;D:\Users\humeng\AppData\Local\Continuum\anaconda3;D:\Users\humeng\AppData\Local\Continuum\anaconda3\Library\bin;

C:\Python27;C:\Python27\Scripts;




你可能感兴趣的:(知识点梳理,Python,Python)