#-*- coding: utf-8 -*-

def avgFirstThreeDigit(lists):
total = 0
for i in range(3):
total += lists[i]
return total / 3


ListIntegers = [18957, 30647, 4653, 1230, 168, 501, 99985, 87965, 534]
output = avgFirstThreeDigit(ListIntegers)
print output

#dosyadan açarsan
with open('Integers.txt') as f:
for line in f:
ListIntegers = line.split(';')
for i,empty in enumerate(ListIntegers):
if not empty:
del ListIntegers[i]
else:
ListIntegers[i] = int(ListIntegers[i])

output = avgFirstThreeDigit(ListIntegers)
print output


Integers.txt
18957;30647;4653;1230;168;501;99985;87965;534;