Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. with open('numbers.txt') as nmbr:
  2.     #read_data = nmbr.read()
  3.     x=nmbr.readline() #reads the first line
  4.     y=nmbr.readline() #reads the second line
  5.    
  6.     print(x)
  7.     print(y)
  8.     numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
  9.     myList = []
  10.  
  11.     for i in x:
  12.         if i in numbers:
  13.             myList.append(int(i))
  14.  
  15.     print myList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement