python的一些使用体会

python刚开始接触,因为刚好有点需求,所以写了点小程序,一点点体会。

优点:

1. os.rename()方法不错,c#就没有这个方法

2.字符串的slice操作不错,取substring有时比较方便

3.单独一段代码块也能运行,写小程序方便

4.[(foo,bar) for i,j in abc] 即所谓list comprehension的写法不错

5.pydub这个库,提供detect_silence方法,NAudio都没这种方法

缺点:

1.没有switch语句,不太方便

2.写gui不如c#方便

3.没有++操作符,非要写成+= 1,稍麻烦

4.没有goto语句,不太方便(比如从多层嵌套循环中跳到最外面,这是Compiler Design in C的作者Allen Holub认为合理使用goto语句的例子之一),虽然goto语句用的不多

5.空格缩进的可读性不如括号

猜你喜欢

转载自www.cnblogs.com/badnumber/p/11241858.html
今日推荐