学过java的,就知道python中类属性相当于java中class的静态变量,都是可以通过class名来直接访问的,python语言不需要static关键字,更省事
2018-01-30
廖老师是编程界大牛,对于看不懂不会的,慢慢理解,亲自上手,过段时间就理解了,以前有java,php,javascript基础,再学python没什么难度
2018-01-30
from os.path import isdir, isfile
print isdir(r'/data/webroot/conf')
print isfile(r'/data/webroot/conf/app.conf')
print isdir(r'/data/webroot/conf')
print isfile(r'/data/webroot/conf/app.conf')
2018-01-29
import math
def is_sqr(x):
return math.sqrt(x) in range(1, 11)
print filter(is_sqr, range(1, 101))
def is_sqr(x):
return math.sqrt(x) in range(1, 11)
print filter(is_sqr, range(1, 101))
2018-01-29
def __call__(self, num):
'''
L = [0,1]
for i in range(num-2):
L.append(L[-1] + L[-2])
print(L)
'''
a, b, L = 0, 1, []
for i in range(num):
L.append(a)
a, b = b, a+b
print(L)
'''
L = [0,1]
for i in range(num-2):
L.append(L[-1] + L[-2])
print(L)
'''
a, b, L = 0, 1, []
for i in range(num):
L.append(a)
a, b = b, a+b
print(L)
2018-01-28
__slots__ = ('score')
def __init__(self, name, gender, score):
super(Student, self).__init__(name, gender)
self.score = score
def __init__(self, name, gender, score):
super(Student, self).__init__(name, gender)
self.score = score
2018-01-28