from absl import app from absl import flags FLAGS = flags.FLAGS flags.DEFINE_string('gpu', None, 'comma separated list of GPU(s) to use.') def main(argv): del argv if FLAGS.gpu: os.environ['CUDA_VISIBLE_DEVICES'] = FLAGS.gpu else: print('Please assig…
开一篇文章,记录关于Python有意思的用法,不断更新 1.Python树的遍历 def sum(t): tmp=0 for k in t: if not isinstance(k,list): tmp+=k else: tmp+=sum(k) return tmp if __name__=='__main__': x=[1,[2,[3,4,5,[6,7,[8,9]]]]] t=sum(x) print(t)…