for line in open(filename):
first, second = line.split()
print(first, second)
import re
digits = re.compile(r'^[\d\+]+$')
def is_string_valid(string):
return bool(digits.match(string))
media = json.loads(api.json)
media['users'][0]['num']
list1 = [x for x in range(1, 20000)]
list2 = [x for x in range(1, 10000)]
set.difference(set(list1), set(list2))
items = [
{'id': '111111111', 'username': 'milk'},
{'id': '222222222', 'username': 'yogurt'},
{'id': '333333333', 'username': 'cat'}
]
items_id = [item.get('id') for item in items]
items_username = [item.get('username') for item in items]
print(items_id)
# ['111111111', '222222222', '333333333']
print(items_username)
# ['milk', 'yogurt', 'cat']
for item in your_list:
print(item['id'], item['username'])
print('\n'.join('%s %s' % (item['id'], item['username']) for item in your_list))