fork download
  1. with open('/tmp/random.txt', 'w') as f:
  2. f.write('1 2 3 4 5 6 7 8 9')
  3.  
  4. sum_ = 0
  5.  
  6. with open('/tmp/random.txt', 'r') as database:
  7. for number in database.read().split():
  8. sum_ += int(number)
  9.  
  10. print(sum_) # Should be 45
Success #stdin #stdout 0.02s 9464KB
stdin
Standard input is empty
stdout
45