Music Player by ReactJs

首先,要是用该命令应该:安装全局的包

1
npm i -g webpack

1. 首先创建package.json

使用npm init, 按照步骤进行设置,最终会获得一个package.json

2. dependencies 各种依赖。

我们可以使用npm工具帮助我们在之前生成的package.json中自动添加。当然还有一些有可能需要我们手动添加依赖,但是安装可以用npm install进行辅助安装,它会自己查找package.json文件,进行安装。

3.

Python_Tuple

和列表的区别:元组不可以被修改。元组一般用大括号括起来

1
2
3
4
5
1,2,3 #(1,2,3)
(1,2,3) #(1,2,3)
() #()
(42,) #一个值的元组
3 * (42.) #(42,42,42)

tuple 函数

和list函数功能相似,以一个序列为参数,转换为一个元组

1
2
3
tuple([1,2,3])  #(1,2,3)
tuple('abc') #('a','b','c')
tuple((1,2,3)) #(1,2,3)

元组的基本操作 创建和访问

1
2
3
x = 1,2,3
x[1] #2
x[1:2] #(2,3)

设立元组的意义

  1. 元组在映射中作为键使用 dictionary中的key
  2. 元组是很多内建函数和方法的返回值,所以必须学会对元组的处理

Webpack

Webpack是打包js模块的工具。。
Webpack的特点:
Code Splitting,Loaders,Clever Parsing,Plugin System

四大部分:entry,output,loader 和 plugins

初识webpack:

  1. 新建文件夹,并初始化一个package.json文件 (npm init)

Python List

一直在用list,遇到不懂就Google,对于一些基础而细节的知识点,感觉总结一下,以后常看可能会更好。

序列:列表和元组

序列中最常用的莫过于列表和元组了。还包括:字符串,Unicode字符串,buffer对象和xrange对象。这里不得不提到容器(container)。序列和映射是两类主要的容器。这里注意区分Set这种容器既不是序列也不是映射。

注意:序列是可以修改的,而元组是不可以的。

序列的操作

所有的序列都是可以进行某些特定的操作,包括:迭代(iteration),索引(indexing),分片(slicing),加(adding),乘(multiplying),计算长度,最大值,最小值等等。

索引

访问某一个元素,索引0返回第一个,-1 返回最后一个元素

1
2
3
str = 'Hello'
str[0] #'H'
str[-1] #'o'

分片

访问一定范围内的元素,通过冒号隔开连个索引值。 注意: 返回值不包含最后的索引值本身。

1
2
3
str = 'Hello world python'
str[1:6] #'ello` '
str[9-2] #'ld pyth'

只要分片左边的索引值比它右边的晚出现在序列中,结果就是空。

1
2
str = 'Hello world python'
str[-2:0] #'[]'

如果不填右边的索引值呢? 分片就会包括到序列结尾的元素。对于不填写左边同样原理

1
2
3
str = 'Hello world python'
str[-2:] #'on'
str[:2] #'He'

新的元素: 步长(step length):上文不填写,默认步长为1. 当然可以进行设置,如2.

1
2
3
str = '123456789'
str[0:7:2] #'135'
str[::2] #'135'

步长不可为0,但可以为负数。

1
2
str = '123456789'
str[7:0:-1] #'65432'

序列相加 使用加运算符,相同类型可以进行链接操作

1
2
[1,2,3,4,5] + [6,7,8,9] = [1,2,3,4,5,6,7,8,9]
'Hello ' + 'World' = 'Hello world'

序列乘法

  1. 用数字N乘以一个序列,这个序列会被重复N次

    1
    2
    'python' * 5 = 'pythonpythonpythonpythonpython'
    [42]* 3 = [42,42,42]
  2. None, 空列表和初始化
    如果想创建一个占用10个元素空间,但是不含有任何内容的列表,我们可以使用None:

    1
    [None] * 10  #'[None,None,None,None,None,None,None,None,None,None]'

检查成员 使用 in

1
2
3
4
users = ['mlh','foo','bar']
'mlh' in users #True
permission = 'rw'
'w' in permission #True

长度,最小值,最大值

使用内建函数:len, min, max.
More info: list

赋值, 删除, 替换

1
2
3
4
5
6
arr = list('hello')  
arr[1:] = list('ey') #['h','e','y']
del arr[1] #['h','y']

numbers = [1,2,3,4,5,6]
numbers[1:4] = [] #[1,5,6]

####列表方法
1.append 2.count 3.extend 4.index 5.insert 6.pop 7.remove 8.reverse 9.sort || sorted(Key和Reverse)

1
2
3
4
numbers = [0,9,3,1,5,6]
numbers.sort(reverse=True) #[6,5,4,3,2,1]
strarr = ['abcasd','aadfaeesdf','ab','dfga','a']
strarr.sort(key=len) #['a', 'ab', 'dfga', 'abcasd', 'aadfaeesdf']

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment