print "I have a proble! And here is at Line: %s"%sys._getframe().f_lineno PDB,哈哈http://docs.python.org/library/pdb.html import fileinput fileinput.filename() import srcinfo print ('warning: %s: %d: %s' %(srcinfo.file(), srcinfo.line(), x)) 绝对路径
读取csv文件: def readCsv(): rows=[] with file(r'E:\py\py01\Data\system.csv','rb') as f: reads=csv.reader(f) for i in reads: rows.append(i) print rows return rows写入csv文件: def writer(): with file(r'E:\py\py01\Data\system.csv','wb') as f: writer=csv.writer(