def file2List(i_fileName):
with open(i_fileName, ‘r’) as file:
whole=[]
mystr=”
for oneLine in file:
contend = oneLine.rstrip(‘\n’).rstrip().split(‘\t’)
whole.append(”.join(contend))
return whole
补充几个小巧的函数
def toNum(i_para):
if type(i_para) == str:
return int(i_para)
else:
return i_para
def toStr(i_para):
if type(i_para) == str:
return i_para
else:
return str(i_para)
def nvl(i_p1, i_p2):
if i_p1 is None or (type(i_p1) == str and i_p1.strip()==”):
return i_p2
else:
return i_p1