UKOL FILES 2 with open('C:\\Users\\341917\\Downloads\\test.txt', 'r') as file_in: with open('C:\\Users\\341917\\Downloads\\out.txt', 'w') as file_out: in_lines = file_in.readlines() # print(in_lines) for i in range(len(in_lines)): file_out.write(str(i) + in_lines[i]) UKOL FILES 3 coords = [[52.23, 21.04], [54.41, 18.65], [53.14, 23.21], [53.4, 14.5]] cities = ['Warszawa', 'Gdansk', 'Bialystok', 'Szczecin'] with open('C:\\Users\\341917\\Downloads\\mesta.kml', 'w') as file: file.write('my first point') for a in range(len(cities)): file.write('') file.write('' + cities[a] + '') file.write('' + str (coords[a][1]) + ', ' + str (coords[a][0])+ '') file.write('\n') HOMEWORK 2 - GeoJSON coords = [[52.23, 21.04], [54.41, 18.65], [53.14, 23.21], [53.4, 14.5]] cities = ['Warszawa', 'Gdansk', 'Bialystok', 'Szczecin'] with open('C:/Users/Adam/Desktop/phd/vyuka/Programovani/test1/poland.geojson', 'w') as json: json.write('{ "type": "FeatureCollection",\n') json.write('"features":[\n') for ci in range(len(cities)): city = cities[ci] json.write('{ "type": "Feature",\n') json.write('"geometry": {"type": "Point", "coordinates": [') json.write(str(coords[ci][1]) + ', ' + str(coords[ci][0])) json.write(']},\n') json.write('"properties": {') json.write('"name": "' + cities[ci] + '",\n') json.write('}\n},\n') json.write(']}')