-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildLocations.py
36 lines (29 loc) · 1007 Bytes
/
buildLocations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cityTable = [['Tornio', 65.85, 24.18, 2],
['Oulu', 65.02, 25.47, 2],
['Helsinki', 60.18, 24.93, 2],
['Oslo', 60.08, 10.66, 1],
['Copenhagen', 55.61, 12.65, 1],
['Vancouver', 49.217, -123.1, -8]]
myData = open("locationData.txt", "wb")
print "File: ", myData.name
if myData.closed:
print "not open!"
else:
print "open mode ", myData.mode
print "file length", len(myData.name)
# myData.write(str(cityTable))
# myData.write("\n")
print "The raw data: ", cityTable, "\n", "-"*12
for i in range(0,6):
city = cityTable[i][0]
latitude = cityTable[i][1]
longitude = cityTable[i][2]
timeZone = cityTable[i][3]
print "City: ", city, "Latitude: ", latitude, "Longitude: ", longitude, "Timezone: ", timeZone
# Tiedostoon
myData.write(city); myData.write(' ')
myData.write(str(latitude)); myData.write(' ')
myData.write(str(longitude)); myData.write(' ')
myData.write(str(timeZone)); myData.write('\n')
print "Pohjoisnavalle matkaa: ", 90 - latitude
myData.close()