如何将变量“display\u lines”的内容放入lis

2024-06-24 13:21:36 发布

您现在位置:Python中文网/ 问答频道 /正文

基本上,我试图将变量display_lines的内容放入一个列表中,然后将其相加,得到平均值

我试过使用.split()函数,但没有用。我也试过使用sum(display_lines),试过了一些东西,但是因为太多了,我记不起来了

from tkinter import *
from tkinter import messagebox
from tkinter.filedialog import askopenfilename
import tkinter.filedialog
from tkinter import filedialog
import csv

def show_contents():
    read = askopenfilename(parent=root)
    read2 = open(read, 'r')
    contents = read2.read()
    output.insert(END, contents)

def Openfile():
    read = askopenfilename(parent=root)
    read2 = open(read, 'r')
    csv_reader = csv.reader(read2, delimiter=',')
    for lines in csv_reader:
        display_lines = lines[1]
        display_list = display_lines.split()
        #sum_list = sum(display_list)
        print(display_list)

def Clear():
    output.delete(1.0, END)

root = Tk()
root.geometry('500x500')
root.title('Open a file')
header = Label(text = 'The contents of a file will be displayed below', bg = 'grey', fg = 'black', width = '500', height = '3', font=('ariel',10,'bold'))
header.pack()

output = Text(root, width=50, height=15)
output.place(x=15, y=60)

button1 = Button(text='Calculate average', width=15, height=2, bg='lightgrey', command= Openfile)
button1.place(x=15, y=320)

button3 = Button(text='Open file  ', width=10, height=2, bg='lightgrey', command= show_contents)
button3.place(x=220, y=320)

button2 = Button(text='Clear', width=10, height=2, bg='lightgrey', command= Clear)
button2.place(x=135, y=320)

我的预期结果是变量display_lines的内容在列表[1, 2, 3, 4, 5, 6, 7, 8, ...]中。然后将添加列表并从中找到平均值

这是变量“display\u lines”的内容(您将看到为什么我第一次没有把它放进去)。这些数字与一个csv文件有关,其中的数字是评级。 1 5 三 三 5 1 三 2 三 1 三 1 1 5 1 5 5 1 5 5 三 5 5 5 三 三 5 1 1 1 5 1 2 1 5 1 5 5 5 三 5 三 1 5 5 5 2 三 5 5 三 1 三 1 5 5 2 1 三 5 5 2 5 1 5 5 1 1 1 1 1 1 5 三 5 1 1 5 5 三 1 1 三 5 4 5 5 1 5 1 1 5 1 5 2 1 5 5 1 1 1 1 2 1 1 5 5 5 5 1 5 1 三 1 1 5 5 1 1 1 1 5 5 5 三 2 1 三 5 1 三 5 5 5 5 三 2 三 5 1 1 1 1 5 5 5 1 2 三 5 5 三 5 5 1 1 1 1 1 5 1 1 1 1 5 1 5 5 1 1 5 1 5 1 三 5 5 1 5 三 5 5 5 5 1 5 1 1 三 1 1 4 1 1 2 1 1 5 1 5 5 2 三 5 1 5 4 1 1 5 1 5 三 三 1 1 5 1 1 三 三 5 5 1 1 5 5 5 1 1 1 5 5 1 三 1 三 5 5 1 5 三 1 5 5 5 5 5 1 5 4 1 1 1 1 5 5 5 1 5 5 5 5 1 1 5 1 1 1 1 5 5 2 5 5 1 5 1 1 1 5 1 5 1 5 三 1 4 1 1 5 5 5 5 5 1 1 三 5 2 5 1 1 5 5 5 5 5 5 1 4 2 5 1 1 5 三 5 1 三 三 5 1 1 5 5 5 1 4 5 5 5 4 三 5 三 三 5 5 1 三 5 5 1 三 5 5 1 5 5 5 5 1 三 5 1 5 1 1 5 1 5 1 5 5 5 1 5 5 5 1 1 5 1 5 5 三 5 2 三 1 三 三 1 5 5 1 三 5 4 5 三 1 1 1 5 1 1 1 5 2 5 1 1 2 5 1 4 5 5 1 三 5 1 4 5 1 5 1 5 2 4 5 5 5 5 1 5 5 5 5 5 三 三 1 1 5 1 三 5 5 1 1 1 三 5 5 三 1 5 5 5 4 三 三 1 5 1 2 三 1 5 5 1 1 5 三 5 5 1 1 1 1 三 5 1 1 1 三 1 1 1 5 1 三 5 5 5 5 三 1 4 三 4 5 2 1 三 5 1 1 三 5 三 1 1 5 1 5 1 1 1 5 5 1 5 5 5 1 5 1 1 1 5 1 1 5 1 1 5 5 5 三 1 1 2 1 5 三 三 1 三 1 1 1 1 5 1 5 三 1 1 5 三 三 1 1 5 5 5 5 5 5 1 2 5 1 三 5 5 1 5 1 5 1 5 三 1 5 1 5 1 5 5 三 1 2 5 5 1 1 三 1 5 5 5 1 5 1 1 5 2 5 5 5 2 三 1 1 三 1 5 1 1 5 1 1 1 5 1 1 5 三 三 2 5 5 5 5 1 1 1 1 三 1 5 5 5 5 1 1 5 1 5 1 5 5 1 1 1 三 1 5 5 5 1 2 1 5 5 5 1 三 5 5 5 1 1 1 1 5 5 1 5 5 1 5 2 5 5 1 1 1 5 5 1 1 5 1 1 1 三 1 1 5 4 1 三 1 5 1 5 三 1 5 1 5 1 1 1 1 1 三 1 5 三 1 1 三 2 1 1 三 5 5 5 5 5 5 5 1 1 5 5 5 1 1 1 三 三 5 三 5 5 1 1 1 5 1 1 4 5 三 1 1 5 三 5 5 1 2 1 1 5 1 1 1 三 5 三 三 1 1 5 三 5 1 三 5 1 三 1 5 5 三 1 5 1 5 1 1 1 5 5 1 1 三 5 5 5 5 1 三 5 1 5 1 5 5 5 1 三 1 三 1 三 1 1 三 5 三 5 三 1 三 三 三 1 1 5 1 三 1 1 4 5 1 5 5 1 1 5 5 5 5 5 1 5 5 1 1 5 三 三 1 1 三 5 1 5 5 1 5 1 1 1 1 5 1 5 1 5 三 1 1 1 1 5 5 1 三 三 5 5 三 1 5 5 1 5 5 5 1 1 5 5 5 5 5 1 5 1 2 1 5 1 5 1 1 1 1 5 1 1 1 1 2 4 1 1 5 5 三 1 1 1 5 5 1 1 5 1 1 1 1 5 1 1 1 1 1 5 5 5 1 1 1 5 2 5 1 1 5 1 1 1 1 1 三 三 1 5 5 三 5 1 5 5 5 1 1 五

heres the full contents of the file
Aber Mawr Bay,1
Aberaeron - Harbour (Fourth Groyne North),5
Aberafan,3
Aberarth,3
Abercastle,5
Aberdaron Beach,1
Aberdeen - Ballroom,3
Aberdour - Silver Sands,2
Aberdyfi,3
Abereiddy Bay - Slipway,1
Abererch,3
Aberffraw Bay (Traeth Mawr),1
Abergele - Pensarn,1
Aberporth - Traeth - y - Dyffryn,5
Abersoch,1
Aberystwyth - Harbour,5
Abrahams Hole,5
Achmelvich Bay,1
Afan. Port Talbot,5
Afon Wen,5
Ainsdale,3
Aldeburgh,5
Aldingham,5
Allhallows,5
Allonby,3
Allonby - South,3
Alnmouth,5
Amble Links,1
Amroth,1
Anderby,1
Annan,5
Ansteys Cove,1
Anstruther. Billow Ness,2
Arbroath - Victoria Park,1
Arch Bay,5
Archirondel,1
Ardrossan (Boydston),5
Ardwell Bay,5
Arnside,5
Askam - in - Furness,3
Avoch,5
Ayr (South),3
Babbacombe Bay. Torquay,1
Baglan. Neath,5
Ballinskelligs,5
Ballybunion North beach,5
Ballycastle,2
Ballygally,3
Ballyhalbert,5
Ballyheigue,5
Ballyholme,3
Ballywalter,1
Balmedie Country Park,3
Bamburgh Castle,1
Banff Bridge,5
Banna Strand,5
Bantham,2
Barafundle Bay,1
Barassie,3
Bardsea,5
Barleycove,5
Barmouth,2
Barmston,5
Barricane Bay  Woolacombe,1
Barrow - in - Furness,5
Barry - Little Island Bay,5
Beachlands Central,1
Beacon Cove,1
Beadnell Bay,1
Beaumaris,1
Beauport,1
Beer,1
Beesands,5
Bembridge,3
Bendricks Beach,5
Benllech,1
Berrow - North of Unity Farm,1
Bertra,5
Berwick - upon - Tweed,5
Bexhill,3
Bigbury on Sea (North),1
Birling Gap,1
Bispham,3
Blackhall,5
Blackpool - Central,4
Blackrock,5
Blackwaterfoot,5
Blue Anchor West,1
Blundellsands,5
Blyth South Beach,1
Bognor Regis - East,1
Bonmahon,5
Bonne Nuit,1
Booby's Beach,5
Bordeaux,2
Borth,1
Boscastle,5
Bossiney Haven,5
Botany Bay,1
Bouley Bay,1
Bournemouth - Alum Chine,1
Bovisand Bay,1
Bowleaze Cove,2
Bracelet Bay,1
Bracklesham Bay,1
Brandy Cove,5
Branscombe,5
Braye Bay,5
Braystones,5
Brean,1
Brean Beach at Brean Farm,5
Bridlington - North Beach,1
Brighouse Bay. Borgue,3
Brightlingsea,1
Brighton - Kemp Town,1
Brittas Bay North,5
Broad Sands,5
Broadhaven,1
Broadhaven South,1
Broadsands,1
Broadsands Beach,1
Broadstairs - East Cliff,5
Brodick Bay,5
Broomhill Sands,5
Brora Beach,3
Broughton Bay,2
Broughty Ferry,1
Brown`s Bay,3
Buckie. Strathlene,5
Bude - Crooklets,1
Budleigh Salterton,3
Bull Bay,5
Bundoran,5
Burgh Island,5
Burghead,5
Burnham Jetty,3
Burntisland,2
Burry Port Beach - East,3
Cadgwith Cove,5
Caerfai Bay,1
Caister Point,1
Calshot,1
Camber,1
Cambois - North,5
Canvey Island,5
Cappagh,5
Carbis Bay Beach,1
Carnlough,2
Carnoustie,3
Carradale,5
Carreg Wen,5
Carrick Bay,3
Carrickfinn,5
Carrowmore,5
Castlerock,1
Castletown,1
Caswell Bay,1
Cawsand Bay,1
Cayton Bay,1
Ceann Tra (Ventry),5
Cemaes,1
Cemaes - Traeth Bach,1
Cemlyn,1
Challaborough,1
Chapel Porth,5
Charlestown,1
Charmouth - East,5
Chesil Cove,5
Christchurch - Avon Beach,1
Church Bay,1
Churston Cove,5
Cilborth,1
Cill Muirbhthe (Kilmurvey),5
Clacton,1
Clacton - Groyne 41,3
Clarach - North,5
Clare Island,5
Cleethorpes,1
Clevedon Bay,5
Cleveleys,3
Cley Beach,5
Clonea,5
Clonque,5
Clovelly,5
Cobo Beach,1
Cocklawburn Beach,5
Cold Knap. Barry,1
Coldingham Bay,1
Collieston,3
Colwell Bay,1
Colwyn Bay,1
Combe Martin,4
Compton Bay,1
Constantine Bay,1
Conwy Morfa,2
Cooden Beach,1
Coppet Hall,1
Corblets,5
Coryton Cove,1
Councillors Strand,5
Courtown,5
Coverack,2
Cowes,3
Cowes - East,5
Crackington Haven,1
Craig Tara (Wonderwest World),5
Cramond,4
Cranfield - Nicholsons Strand,1
Crantock,1
Craster,5
Crawfordsburn. Bangor,1
Cresswell,5
Criccieth,3
Criccieth - West End,3
Crimdon - Park,1
Crinnis Beach - Golf Links,1
Cromarty,5
Cromer,1
Croy,1
Croyde Bay,3
Cruden Bay,3
Cuckmere Haven Beach,5
Culdaff,5
Cullen,1
Culzean,1
Curracloe,5
Cushendall,5
Cushendun,5
Cwm yr Eglwys,1
Cwmtydu,1
Dale,1
Dalgety Bay (Yacht Club),5
Dalton Burn,5
Dartmouth Castle and Sugary Cove,1
Dawlish - Town,3
Daymer Bay,1
Deal Castle,3
Deganwy North,5
Denemouth South,5
Derbyhaven,1
Derrynane,5
Dhoon,3
Dinas Dinlle (Morfa Dinlle),1
Dollymount Strand,5
Donabate,5
Doniford,5
Dooega,5
Doonfoot,5
Dornoch,1
Dornoch - burn mouth,5
Douglas - Broadway,4
Dover Harbour,1
Dovercourt Bay,1
Downderry,1
Druidston Haven,1
Drummore,5
Druridge Bay,5
Dugort,5
Dunbar - Belhaven,1
Duncannon,5
Dunglass,5
Dunnet Bay - Castlehill,5
Dunoon West Bay,5
Dunster North West,1
Dunure,1
Dunwich,5
Duporth Beach,1
Durdle Door - East,1
Dyffryn (Llanendwyn),1
Dymchurch,1
Dymchurch - Hythe Road,5
Earls Dyke,5
Earlsferry,2
Easington,5
East Quantoxhead,5
Eastbourne,1
Eastbourne - East of Pier,5
Easthaven,1
Eastney,1
Eastoke,1
Elbury Cove,5
Elie (Woodhaven & Ruby Bay),1
Elly Bay,5
Embo Beach,1
Enniscrone,5
Ettrick Bay. Bute,3
Exmouth,1
Eyemouth,4
Eypemouth,1
Fairbourne,1
Fairlie,5
Fall Bay,5
Falmouth (Feock Loe Beach),5
Fanore,5
Featherbed Rocks,5
Felixstowe - North,1
Felpham,1
Fenella Beach,3
Fenit,5
Fermain,2
Ferryside Beach,5
Filey,1
Findhorn,1
Findhorn Family Beach,5
Findochty,5
Fintra,5
Firemore. Poolewe,5
Fishermans Haven,5
Fisherrow - East,5
Flamborough - Danes Dyke,1
Fleetwood,4
Folkestone,2
Folkestone - The Warren,5
Fontygary Bay,1
Formby,1
Formby - Victoria Road,5
Fort Perch Rock,3
Fortrose,5
Fraisthorpe,1
Fraserburgh,3
Fraserburgh. Philorth,3
Freathy,5
Freshwater East,1
Frinton,1
Gairloch,5
Gairloch - Big Sand,5
Gammons Head,5
Ganavan,1
Gansey Bay (Bay Ny Carrickey),4
Garretstown,5
Garrylucas,5
Garryvoe,5
Garwick,4
Gelliswick. Milford Haven,3
Gilfach yr Halen,5
Girvan,3
Glen Beach,3
Glenarm,5
Golden Strand,5
Golspie - North,1
Goodrington Sands,3
Goodwick - Harbour South,5
Goring Beach,5
Gorleston Beach,1
Gorran Haven - Little Perhaver,3
Gosford Sands,5
Gourock West Bay,5
Grandes Rocques,1
Grange - over - Sands & Kents Bank,5
Grangetown,5
Great Mattiscombe,5
Greatstone Beach,5
Green Island,1
Greenan,3
Greenaway Beach,5
Greve de Lecq,1
Greystones,5
Groomsport,1
Grouville,1
Gruinard Beach,5
Gullane,1
Gunwalloe Cove,5
Gurnard,1
Gwbert - on - Sea at Craig y Gwent,5
Gwenver beach,5
Gwithian,5
Gyllyngvase,1
Hall Road West. Crosby,5
Hallsands,5
Hampton Pier - East,5
Harlech,1
Harlyn Bay,1
Harrington,5
Hartland Quay,1
Hartlepool North Sands,5
Harwich - Beacon Hill,5
Hastings,3
Hastings - Bulverhythe,5
Havelet Bay,2
Haverigg,3
Havre des Pas,1
Heacham - S.Sands Club,3
Heads of Ayr,3
Helens Bay,1
Helensburgh,5
Hemmick Beach,5
Hemsby,1
Herne Bay,3
Hest Bank,5
Heysham (Half Moon Bay),4
Hightown,5
Hill Head,3
Hive Beach. Burton Bradstock,1
Holland,1
Hollicombe,1
Holy Island (Lindisfarne),5
Holywell Bay,1
Hope Cove,1
Hopeman East,1
Horden,5
Hornsea,2
Hornsea South Beach,5
Hove,1
Hove West,1
Humberston Fitties Beach,2
Hunstanton - South,5
Hythe,1
Ilfracombe - Capstone (Wildersmouth),4
Inch,5
Inchydoney,5
Ingoldmells South,1
Instow,3
Inverbervie,5
Inverboyndie,1
Irvine - Gailes (New Town),4
Isle of Harris,5
Jacksons Bay Barry,1
Jangye Ryne,5
Jaywick,1
Jersey Marine - Central,5
Joss Bay,2
Jurby,4
Kames Bay,5
Keel,5
Keem,5
Kells,5
Kennack Sands,1
Kessingland,5
Kilchattan Bay,5
Kilkee,5
Killahoey,5
Killiney,5
Kimmeridge Bay,3
Kinghorn - Harbour,3
Kingsand Bay,1
Kingsbarns,1
Kingsdown Beach,5
Kinmel Bay (sandy cove),1
Kirk Michael,3
Kirkcaldy - Linktown,5
Kynance Cove,5
L'Eree,1
La Haule,1
Ladies Bay,1
Ladram Bay,3
Lahinch,5
Lamorna Cove,5
Lancing - Green Beach,3
Langland Bay,1
Lantic Bay,5
Largo East,5
Largs,5
Largs - Main,4
Laxey,3
Leasowe Bay,3
Lee - on - Solent,1
Leonards Cove,5
Lepe,1
Leven - East,2
Leysdown - on - sea,3
Limeslade Bay,1
Limpert Bay  Aberthaw,5
Lisfannon,5
Little Haven,1
Littlehampton,1
Littlehampton - Coastguard Station,5
Littlestone,3
Llanbedrog,5
Llanbedrog Beach North,5
Llandanwg,1
Llanddona,1
Llanddulas,1
Llanddwyn Beach,1
Llandudno - North Shore,3
Llanelli & Loughor Estuary (Fourth Groyne),5
Llanfaelog - Porth Nobla,1
Llanfairfechan,1
Llangrannog,1
Llanina,3
Llanon (Slipway),1
Llanrhystyd - South,1
Llansantffraid,1
Llanstephan & Tywi Estuary,5
Llantwit Major Beach,1
Lleiniog Beach. Penmon,3
Llwyngwril,5
Loch Linnhe (Underwater Centre Pier),5
Longhoughton Steel,5
Longis Bay,5
Longniddry,3
Looe - East,1
Lossiemouth - East,4
Low Newton,3
Lower Largo,4
Lowestoft - Gunton Denes,5
Lulworth Cove,2
Lunan Bay,1
Lunderston Bay,3
Lundin Links,5
Lusty Glaze,1
Lydstep Haven,1
Lyme Regis - Church Beach,3
Lyne Mouth Bay,5
Lynmouth,3
Mablethorpe Town,1
Machrihanish,1
Machroes,5
Maen Porth,1
Magherabeg,5
Magilligan - Downhill,1
Maidencombe - Torbay,1
Maidens Turnberry,1
Malahide,5
Man Sands,5
Manorbier Bay,1
Mappleton Beach,5
Marazion,5
Marble Hill,5
Margate - Fulsam Rock,1
Mariners Road. Crosby,5
Marloes Sands,1
Marsden,1
Martins Haven,1
Maryport,5
Mawgan Porth,1
Meadfoot - Torbay,1
Mellon Udrigle. Laide,5
Melvich Bay,1
Meols,1
Mevagissey,5
Mewslade Bay East,5
Mexico Towan,5
Middleton - on - Sea,3
Milford - on - sea,1
Mill Bay,1
Millendreath,2
Millisle Lagoon,1
Millom,5
Millport. Cumbrae,3
Minehead - Terminus,3
Minnis Bay,1
Minster Leas,3
Moelfre,1
Moggs Eye,1
Monifieth,1
Monkstone Beach (near tenby),1
Monreith,5
Montrose,1
Morar Beach,5
Morecambe - North,3
Moreton,1
Morfa Bychan,1
Mortehoe - Rockham Bay,5
Mossyard,3
Mothecombe,3
Mother Ivey's Bay,1
Mounts Bay - Heliport,1
Mousehole,5
Mouthwell Sands,5
Muchalls,5
Mullaghmore,5
Mullaghroe,5
Mulranny,5
Mundesley,1
Murlough,2
Murvagh,5
Mwnt,1
Nairn - central,3
Nanjizal,5
Narin,5
Ness Cove,1
Nethertown,5
New Quay - North Beach,1
Newbiggin,5
Newbiggin - North,1
Newburgh,5
Newcastle,3
Newgale Sands,1
Newhaven,5
Newhaven - West Quay,1
Newport - Car Park Slip,5
Newquay - Fistral,1
Newry Beach. Holyhead,5
Neyland Slip,5
Nolton Haven,3
Normans Bay,1
North Berwick - Milsey Bay,2
Northcott,5
Norton,5
Oddicombe Beach,1
Ogmore,1
Ogmore West,3
Old Colwyn,1
Overcombe,5
Overstrand,5
Owenahincha,5
Oxwich Bay,1
Padstow,5
Pagham,1
Paignton - Paignton Sands,1
Palm Bay,5
Par,2
Parton,5
Patch,5
Pathhead Sands,5
Pease Bay,2
Peel,3
Peffersands,1
Pembrey Beach - Llanelli (Cefn Sidan),1
Pembroke Bay,3
Penally,1
Penarth,5
Penbryn,1
Pendine Sands,1
Pendower - Carne Beach,5
Penmaenmawr,1
Penrhyn Bay,1
Pentewan Sands,1
Pentraeth,5
Perran Sands - Perranuthnoe,1
Perranporth Penhale Sands,1
Peter's Point,5
Peterhead Lido,3
Petit Bot Bay,3
Pevensey Bay,2
Pilling Sands,5
Pittenweem,5
Plas Menai,5
Platte Saline,5
Plemont,1
Plymouth Hoe - East,1
Point of Ayr. Talacre,1
Poldhu Cove,1
Polkerris,3
Pollurian Cove,1
Polnare Cove,5
Polpeor,5
Polperro,5
Polridmouth Beach,5
Polstreath,1
Polzeath,1
Pontllyfni,5
Poole - Branksome Chine,1
Poppit Sands - East,5
Porlock Weir,1
Port,5
Port Dinorwic Sailing Club. Felinheli,5
Portballintrae (Salmon Rock),1
Portelet,1
Portelet Bay,1
Porth Beach,3
Porthallow,1
Porthbean Beach,5
Porthbeor,5
Porthcawl - Newton Bay,5
Porthcothan,1
Porthcurnick,2
Porthcurno,1
Portheras Cove,5
Porthglaze Cove,5
Porthgwarra,5
Porthleven - West,1
Porthluney Cove,3
Porthmeor Cove,5
Portholland Beach,5
Porthor (Oer),5
Porthoustock,1
Porthpean,1
Porthselau,1
Porthtowan,1
Porthzennor Cove,5
Portkil / Meikleross,5
Portland Harbour - Castle Cove,1
Portloe,5
Portlogan Bay,5
Portmahomack,1
Portobello,5
Portobello - Central (James Street),2
Portpatrick (Outer Harbour),5
Portrane,5
Portreath,1
Portrush - Curran (East) Strand,1
Portrush. Whiterocks,1
Portsalon,5
Portscatho,5
Portstewart (The Strand),1
Portwrinkle,1
Powfoot,5
Praa Sands East,1
Prestatyn Central beach,1
Prestatyn. Barkby beach,1
Prestwick,3
Priory Bay. Caldy Island,1
Putsborough,1
Pwlldu Bay,5
Pwllgwaelod,4
Pwllheli,1
Ramsey,3
Ramsgate Sands,1
Ravenglass,5
Readymoney (Fowey),1
Reculver Beach,5
Red Rocks Hoylake,3
Redcar - Coatham,1
Redgate,5
Reighton,1
Rhos - y - Llan,5
Rhoscolyn - Borth Wen,1
Rhosneigr,1
Rhosneigr - Treath Crigyll,1
Rhossili Bay,1
Rhossilli Bay - Hillend,1
Rhyl,3
Ringstead Bay,1
Rinsey Head,5
Roan Head,3
Robin Hoods Bay,1
Rock,1
Rockcliffe,3
Roker - Sunderland,2
Roome Bay. Crail,1
Rosehearty,1
Rosemarkie North,3
Ross,5
Rossbeigh,5
Rosses Point,5
Rossglass,5
Rosslare,5
Rossnowlagh,5
Row Cove Beach (Stoke Beach),5
Rozel,1
Runswick Bay,1
Rushy Bay,5
Ryde - Spring Vale,5
Ryhope East Beach,5
Saint`s Bay,1
Salcombe - North Sands,1
Saltburn,1
Saltcoats,3
Saltdean,3
Salthill,5
Sandend Bay,3
Sandgate - Town Centre,5
Sandhead,5
Sandown,1
Sandown - Yaverland,1
Sandsend,1
Sandside Bay,5
Sandwich Bay,1
Sandy Bay,1
Sandyhills,4
Sandymere,5
Sango Bay. Durness,3
Saundersfoot,1
Saunton Sands,1
Saye,5
Scarborough - South Bay,3
Scourie,5
Scratby Beach,5
Sea at Marske Sands,1
Seaburn - Sunderland,2
Seacliff,1
Seaford,1
Seaford Bay (unpublish),5
Seagrove,1
Seaham Beach,1
Seahouses North,1
Seamill,3
Seapoint,5
Seascale,3
Seaton,3
Seaton - Devon,1
Seatown,1
Sedgwell Cove,5
Selsey,3
Selsey - Hillfield Road,5
Sennen Cove,1
Seton Sands. Longniddry,3
Shakespeare Beach,5
Shaldon,1
Shandwick Bay,3
Shanklin,1
Shanklin - Welcome Beach,5
Sharrow,5
Sheerness Beach,3
Shell Bay North,1
Shelling Hill,5
Sheringham,1
Shipload Bay,5
Shoalstone Beach,1
Shoebury East,1
Shoeburyness,1
Shoreham - Kingston Beach,5
Siddick,5
Sidmouth - Jacobs Ladder,1
Silecroft,1
Silloth,3
Silverknowes,5
Silverstrand,5
Sinclairs Bay - Keiss,5
Singing Sands,5
Skegness,1
Skinburness,3
Skinningrove (Cattersty Sands),5
Skipsea,1
Skrinkle,5
Slapton Sands - Monument,1
Snettisham Beach,5
Soar Mill Cove,5
Solent Breezes,5
South Shields,1
Southend - Chalkwell Beach,3
Southerndown,1
Southerness,3
Southport,1
Southsea,3
Southsea (200m west of EC site),1
Southwick,1
Southwold - The Denes,3
Spiddal,5
Spittal,3
Spittal - Quay,5
Splash Point. Rhyl,3
St.Agnes - Trevaunance Cove,1
St.Andrews - West Sands,3
St.Brelade`s Bay,3
St.Brides Haven,3
St.Helens,1
St.Ives - Porth Gwidden,1
St.Just - Porthnanven,5
St.Margaret`s Bay,1
St.Marys Bay,3
St.Ninians Isle,1
St.Ouens Bay - Le Braye,1
St.Annes,4
St.Antonys Head,5
St.Bees,1
St.Brides,5
St.Combs,5
St.Cyrus,1
St.Davids. Benllech,1
St.Dogmaels Slipway,5
St.Georges Pier. Menai Bridge,5
St.Ishmael. Kidwelly,5
St.Ishmaels (Lindsway Bay),5
St.Just Priests Cove,5
St.Leonards,1
St.Marys Well Bay. Barry,5
St.Mawes,5
St.Mildreds Bay,1
St.Ouens Bay - Watersplash,1
St.Abbs,5
Staithes,3
Stevenston,3
Stokes Bay,1
Stone Bay,1
Stonehaven - Carron,3
Stranraer - Cockle Shore,5
Strathy Bay,1
Strete Gate Beach,5
Stroove,5
Studland Knoll House,1
Sunderland - Hendon South,5
Sutton - on - Sea,1
Swanage,1
Swanlake Bay,1
Swanpool,1
Swansea Bay - County Hall,5
Tal - y - bont,1
Talland Bay,5
Tankerton Beach,1
Tayport,5
Teignmouth - Holcombe,3
Tenby - Castle Beach,1
Tentsmuir Sands,1
The Sands of Breckon,1
Thorntonloch,1
Thornwick Bay,5
Three Cliffs Bay,5
Thurlestone - North,1
Thurso Bay Central,3
Thurstaston,3
Tintagel,5
Torbay Crawley Woods,5
Torre Abbey,3
Totland Bay,1
Towan Beach,5
Tra And Oil In,5
Traeth Lligwy,1
Tragumna,5
Tramor Coil Rua,5
Traught,5
Trearddur Bay,1
Trebarwith Strand,1
Trefor,5
Trefusis Beach at Flushing,5
Tregantle Cliff Beach. Whitsand Bay,5
Tregardock,5
Tregonhawke Beach. Whitsand Bay,5
Tresaith,1
Tresilian Bay,5
Tresta Sands,1
Trevone,2
Treyarnon Bay,1
Troon - North,5
Tunstall,1
Turnberry,5
Tynemouth - Cullercoats,1
Tynemouth. King Edwards Bay,1
Tyrella,1
Tywyn,1
Upton Towans,5
Vazon,1
Ventnor,1
Victoria Pool,1
Wallasey,1
Walney Island - Biggar Bank,2
Walpole Bay,4
Walton,1
Warkworth,1
Warrenpoint,5
Watchet,5
Watcombe,3
Waterfoot,1
Watergate Bay,1
Waterwynch Bay,1
Watwick,5
Welcombe Mouth,5
Wells - next - the - Sea,1
Wembury,1
Wemyss Bay,5
West Angle Bay,1
West-Bay,1
West Kirby,1
West Mersea,1
West Runton,5
West Sandwick Beach,1
West Voe Sands,1
West Wittering,1
Westbrook Bay,1
Westdale,1
Westhaven,5
Weston Hard Woolston,5
Weston-super-Mare Grand Pier,5
Westward Ho!,1
Weymouth - Central,1
Whitby,1
White-Strand,5
Whitecliff Bay,2
Whitehaven,5
Whitesands,1
Whitesands Bay,1
Whiting Bay,5
Whitley Bay,1
Whitmore Bay. Barry,1
Whitstable West Beach,1
Widemouth Sand,1
Wilsthorpe,1
Winchelsea,3
Wisemans Bridge,3
Withernsea,1
Wonwell Sands,5
Woody Bay,5
Woolacombe - Village,3
Workington,5
Worthing,1
Worthing - East Pier,5
Wringcliff,5
Yarmouth,5
Yellowcraigs,1
Ynyslas - Northern Groyne (Sea),1
Youghal Claycastle,5

Tags: ofdisplaystlineswestsoutheastbay
1条回答
网友
1楼 · 发布于 2024-06-24 13:21:36

对于空列表,它将工作,下面的代码是为我从输入文件的几行工作。你知道吗

import csv

read = open('input.txt', 'r')
csv_reader = csv.reader(read, delimiter=',')
sum_list=[]
for lines in csv_reader:
     display_lines = lines[1]
     sum_list.append(int(display_lines))

print(sum(sum_list))

enter image description here

相关问题 更多 >