Skip to content

Instantly share code, notes, and snippets.

@mwrites
Last active March 23, 2018 10:08
Show Gist options
  • Save mwrites/291058f6b4ca9df08f989f1ce91aa11d to your computer and use it in GitHub Desktop.
Save mwrites/291058f6b4ca9df08f989f1ce91aa11d to your computer and use it in GitHub Desktop.
Reading input in python
# Create array from lines of separated values such as 1 2 3
arr = list(map(int, input().strip().split(' ')))
import sys
def read_in():
return [x.strip() for x in sys.stdin]
lines = read_in()
print(lines)
lines = input()
for i in range(int(lines)):
line = input()
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment