457475451 发表于 2018-8-11 09:44:29

python读文件算数

  #cat 1
  1
  2
  3
  #cat 2
  4
  5
  6
  ########################
  import os
  acmd='cat 1'
  bcmd='cat 2'
  a = os.popen(acmd).readlines()
  b = os.popen(bcmd).readlines()
  i=0
  while i<3:
  print int(a.strip()) + int(b.strip())
  i+=1
页: [1]
查看完整版本: python读文件算数