Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将web摘要转换为excel?_Excel_Python 3.x_Beautifulsoup - Fatal编程技术网

将web摘要转换为excel?

将web摘要转换为excel?,excel,python-3.x,beautifulsoup,Excel,Python 3.x,Beautifulsoup,更新:我试图在Pycharm上安装pandas模块,但出现错误?(索引器:列表索引超出范围) 我还尝试在命令提示符窗口中使用C:>pip安装,但没有成功 我也试过这个 我终于能够让pip安装熊猫工作了,但它仍然说我没有模块 我正在尝试将这些信息自动保存到类似于此的excel文件中 我的输出如下:如何使它自动上传到excel文件中,最好是上传到与我添加的图片类似的图表中 Player of the Year: Kyle McCord, St. Joseph’s Prep Coach of the

更新:我试图在Pycharm上安装pandas模块,但出现错误?(索引器:列表索引超出范围)

我还尝试在命令提示符窗口中使用C:>pip安装,但没有成功

我也试过这个

我终于能够让pip安装熊猫工作了,但它仍然说我没有模块

我正在尝试将这些信息自动保存到类似于此的excel文件中

我的输出如下:如何使它自动上传到excel文件中,最好是上传到与我添加的图片类似的图表中

Player of the Year: Kyle McCord, St. Joseph’s Prep
Coach of the Year: Calvin Everett, Harrisburg
Quarterback
Kyle McCord, St. Joseph’s Prep – 6-3, 195 sophomore
Kane Everson, Harrisburg – 5-11, 180 senior
Cade Pribula, Central York – 6-1, 200 senior
Ricky Ortega, Coatesville – 6-0, 190 junior
Tommy Friberg, State College – 6-5, 200 junior
Running Back
Nyzair Smith, Dallastown – 5-10, 187 senior
Aaron Young, Coatesville – 5-11, 190 senior
Shamar Edwards, North Penn – 5-11, 190 senior
Damon Horton, Hazleton – 5-10, 200 senior
Elijah Morales, Wilson-West Lawn – 5-9, 160 senior
Wide Receiver
Dapree Bryant, Coatesville – 5-8, 175 junior
Johnny Freeman, St. Joseph’s Prep – 6-1, 205 junior
Tommy Manos, Nazareth – 6-0, 180 senior
Jacob Hunsinger, Hazleton – 6-1, 185 senior
Marvin Harrison Jr., St. Joseph’s Prep – 6-3, 175 sophomore
Tight End
Nick Gallo, Council Rock South – 6-4, 235 senior
Offensive Line
Andrew Kristofic, Pine-Richland – 6-6, 275 senior
Ramsey Kifolo, State College – 6-3, 315 junior
Mike Katic, Pine-Richland – 6-3, 280 senior
Raymond Christas, Dallastown – 6-2, 260 senior
Ricky Santiago, Coatesville – 6-5, 305 senior
Athlete
Marques Mason, St. Joseph’s Prep – 5-8, 165 senior
Dresyn Green, State College – 5-10, 170 sophomore
Specialist
Jack Rodenberger, Manheim Twp. – 6-0, 175 senior
Defensive Line
Trevor Harris, Liberty – 6-3, 235 senior
Dionte Nichols, Harrisburg – 6-2, 230 senior
Cade Brennan, Garnet Valley – 6-4, 235 senior
Brian Dallas, Pittsburgh C.C. – 6-4, 225 senior
Linebacker
Tristan Wheeler, Bethlehem Freedom – 6-2, 225 senior
Andre White Jr., Harrisburg – 6-3, 215 senior
Tyler King, Pine-Richland – 6-1, 220 senior
Myles Talley, St. Joseph’s Prep – 5-10, 200 senior
Elijah Workinger, Red Lion – 6-5, 250 senior
Adam Burkhart, Central Dauphin – 5-11, 215 senior
Jeremiah Trotter Jr., St. Joseph’s Prep – 6-0, 200 sophomore
Defensive Back
Joey Porter Jr., North Allegheny – 6-2, 187 senior
Keaton Ellis, State College – 6-1, 185 senior
Sammy Knipe, State College – 6-1, 210 sophomore
Dom Dodson, Pittsburgh C.C. – 5-11, 185 senior
Isaiah Gilmore, Wilson-West Lawn – 5-11, 185 senior
Athlete
Cohen Russell, State College – 5-8, 175 senior
Donte Kent, Harrisburg – 5-11, 170 junior
CLASS 4A
Player of the Year: Billy Lucas, Cathedral Prep
Coach of the Year: Mike Mischler, Cathedral Prep
OFFENSE
Quarterback
Jamie Diven, South Fayette – 6-1, 195 senior
Chase Diehl, Bishop McDevitt – 6-0, 205 senior
Isaac Rumery, Clearfield – 6-1, 205 senior
Deven Bollinger, Northwestern Lehigh – 6-4, 195 junior
Running Back
Billy Lucas, Cathedral Prep – 6-0, 205 senior
Ian Csicsek, Saucon Valley – 5-10, 185 senior
Max Shaw, Thomas Jefferson – 6-0, 190 senior
Mason Kordish, Valley View – 5-8, 170 senior
Tavion Banks, Bethlehem Catholic – 5-10, 187 junior
Wide Receiver
Nazir Burnett, Bishop McDevitt – 6-2, 175 senior
Mike Trimbur, South Fayette – 5-11, 180 senior
Dan Deabner, Thomas Jefferson – 6-0, 180 junior
Yusuf Terry, Imhotep Charter – 6-4, 175 senior
Tight End
Demonte Martin, Eastern York – 6-5, 195 senior
Offensive Line
Chris Oliver, Cathedral Prep – 6-4, 293 senior
Tim Weaver, Saucon Valley – 6-5, 285 senior
Dalton Daddona, Bethlehem Catholic – 6-3, 280 senior
Quentin Bloom, Clearfield – 6-0, 307 junior
Shane Murphy, Berks Catholic – 6-4, 270 senior
Marlon Westcott, Imhotep Charter – 6-2, 305 senior
Athlete
Janaasah Boone, Valley View – 6-0, 175 junior
Abdul MacFoy, Berks Catholic – 5-7, 165 junior
Specialist
Ryan Coe, South Fayette – 6-2, 225 senior
DEFENSE
Defensive Line
Joey Scarabino, Cathedral Prep – 6-3, 241 senior
Caleb Rockey, Bellefonte – 6-3, 245 senior
Ryan Bodolus, Pottsgrove – 6-1, 220 senior
David Tomb, Jersey Shore – 6-0, 205 senior
Luke Painton, Berks Catholic – 6-7, 245 senior
Carter Christopher, Bishop McDevitt – 6-3, 285 senior
Linebacker
Brandon George, Berks Catholic – 6-4, 240 senior
Paul Carreras, Bethlehem Catholic – 6-0, 225 senior
Traon Jones, Valley View – 5-5, 155 senior
Hunter O’Connor, Jersey Shore – 6-0, 225 senior
Dray Donley, Bishop McDevitt – 6-0, 215 senior
Defensive Back
Teagan Wilk, Berwick – 5-11, 180 junior
Alex MacKenzie, Conrad Weiser – 6-3, 195 senior
Nehemiah Figueroa, Pottstown – 5-10, 170 senior
Jaden Duplessis, Valley View – 6-1, 175 senior
Athlete
Tykee Smith, Imhotep Charter – 6-0, 190 senior
Kenyon Johnson, West Perry – 5-11, 180 junior
CLASS 2A
Player of the Year: Julian Fleming, Southern Columbia
Coach of the Year: Brandon Phillian, Wilmington
OFFENSE
Quarterback
Stone Hollenbach, Southern Columbia – 6-3, 200 senior
Skyy Moore, Shady Side Academy – 5-11, 185 senior
Aaron Tobias, Penns Valley – 6-2, 195 junior
John Caldwell, Ligonier Valley – 5-10, 150 senior
Logan Pfister, Chestnut Ridge – 6-1, 163 sophomore
Derek Johncour, Avonworth – 6-3, 181 senior
Running Back
Kobe Brish, Schuylkill Haven – 5-9, 200 junior
Gaige Garcia, Southern Columbia – 5-10, 195 junior
Christian Clutter, McGuffey – 6-0, 180 senior
Kam Williams, Steel Valley – 6-0, 185 senior
Kobe Joseph, Sharpsville – 6-3, 220 senior
Wide Receiver
Bryan Dworek, Brookville – 5-11, 175 senior
Aaron Tutino, Ligonier Valley – 5-11, 170 senior
Julian Fleming, Southern Columbia – 6-3, 215 junior
Cabe Park, Brookville – 5-9, 165 senior
Tight End
Logan Snyder, Penns Valley – 6-2, 200 junior
Offensive Line
Ja’Quay Hubbard, Sharpsville – 6-6, 315 senior
Austin Homan, Schuylkill Haven – 6-0, 243 senior
Troy Donlan, Southern Columbia – 6-0, 260 senior
Dylan Dininny, Richland – 6-5, 255 senior
Oak Six, Southern Columbia – 6-3, 265 senior
Athlete
Ryan Ripka, Penns Valley – 5-8, 160 senior
Aidan Houser, Wellsboro – 5-9, 165 junior
Specialist
Zane Puhala, Brockway – 5-10, 175 senior
DEFENSE
Defensive Line
Michael Hood, Mount Carmel – 6-0, 200 senior
Jimmy Reed, Wilmington – 6-2, 225 senior
Collin Instone, Richland – 6-3, 260 senior
Jordan Gray, Wilmington – 6-1, 235 senior
Harris Kohl, York Catholic – 6-0, 200 senior
Hunter Brown, Wellsboro – 6-4, 220 senior
Linebacker
Cal Haladay, Southern Columbia – 6-1, 190 junior
Colton Richards, Wilmington – 6-2, 270 senior
Todd Hill, Steel Valley – 5-10, 225 senior
Max Tillett, Southern Columbia – 6-0, 190 junior
Garrett David, North Penn-Mansfield – 6-3, 225 senior
Jarred Kohl, York Catholic – 6-1, 205 senior
Defensive Back
Cameron Marett, Wilmington – 5-8, 175 senior
Macen Akers, Everett – 6-1, 180 senior
Daniel Walker, Washington – 6-3, 210 senior
Daunte Allegretto, Ridgway – 5-8, 145 senior
Athlete
Robert Pontius, Wilmington – 6-4, 195 senior

在线查看:

您的问题是什么?您是否研究过如何使用熊猫创建数据框,然后再创建csv?还是csv和csv.writer?这个网站上有很多例子以及网上的教程可以帮助你。谢谢。我对编码是全新的,所以我不确定要搜索什么。在提出更多问题之前,我显然需要继续学习。我会研究pandas@iFreeSki420我现在正在做。不worries@iFreeSki420我一直在研究你的老问题,所以我知道你想要实现什么。检查我的答案,如果它满足你的目标,就接受它。
Player of the Year: Kyle McCord, St. Joseph’s Prep
Coach of the Year: Calvin Everett, Harrisburg
Quarterback
Kyle McCord, St. Joseph’s Prep – 6-3, 195 sophomore
Kane Everson, Harrisburg – 5-11, 180 senior
Cade Pribula, Central York – 6-1, 200 senior
Ricky Ortega, Coatesville – 6-0, 190 junior
Tommy Friberg, State College – 6-5, 200 junior
Running Back
Nyzair Smith, Dallastown – 5-10, 187 senior
Aaron Young, Coatesville – 5-11, 190 senior
Shamar Edwards, North Penn – 5-11, 190 senior
Damon Horton, Hazleton – 5-10, 200 senior
Elijah Morales, Wilson-West Lawn – 5-9, 160 senior
Wide Receiver
Dapree Bryant, Coatesville – 5-8, 175 junior
Johnny Freeman, St. Joseph’s Prep – 6-1, 205 junior
Tommy Manos, Nazareth – 6-0, 180 senior
Jacob Hunsinger, Hazleton – 6-1, 185 senior
Marvin Harrison Jr., St. Joseph’s Prep – 6-3, 175 sophomore
Tight End
Nick Gallo, Council Rock South – 6-4, 235 senior
Offensive Line
Andrew Kristofic, Pine-Richland – 6-6, 275 senior
Ramsey Kifolo, State College – 6-3, 315 junior
Mike Katic, Pine-Richland – 6-3, 280 senior
Raymond Christas, Dallastown – 6-2, 260 senior
Ricky Santiago, Coatesville – 6-5, 305 senior
Athlete
Marques Mason, St. Joseph’s Prep – 5-8, 165 senior
Dresyn Green, State College – 5-10, 170 sophomore
Specialist
Jack Rodenberger, Manheim Twp. – 6-0, 175 senior
Defensive Line
Trevor Harris, Liberty – 6-3, 235 senior
Dionte Nichols, Harrisburg – 6-2, 230 senior
Cade Brennan, Garnet Valley – 6-4, 235 senior
Brian Dallas, Pittsburgh C.C. – 6-4, 225 senior
Linebacker
Tristan Wheeler, Bethlehem Freedom – 6-2, 225 senior
Andre White Jr., Harrisburg – 6-3, 215 senior
Tyler King, Pine-Richland – 6-1, 220 senior
Myles Talley, St. Joseph’s Prep – 5-10, 200 senior
Elijah Workinger, Red Lion – 6-5, 250 senior
Adam Burkhart, Central Dauphin – 5-11, 215 senior
Jeremiah Trotter Jr., St. Joseph’s Prep – 6-0, 200 sophomore
Defensive Back
Joey Porter Jr., North Allegheny – 6-2, 187 senior
Keaton Ellis, State College – 6-1, 185 senior
Sammy Knipe, State College – 6-1, 210 sophomore
Dom Dodson, Pittsburgh C.C. – 5-11, 185 senior
Isaiah Gilmore, Wilson-West Lawn – 5-11, 185 senior
Athlete
Cohen Russell, State College – 5-8, 175 senior
Donte Kent, Harrisburg – 5-11, 170 junior
CLASS 4A
Player of the Year: Billy Lucas, Cathedral Prep
Coach of the Year: Mike Mischler, Cathedral Prep
OFFENSE
Quarterback
Jamie Diven, South Fayette – 6-1, 195 senior
Chase Diehl, Bishop McDevitt – 6-0, 205 senior
Isaac Rumery, Clearfield – 6-1, 205 senior
Deven Bollinger, Northwestern Lehigh – 6-4, 195 junior
Running Back
Billy Lucas, Cathedral Prep – 6-0, 205 senior
Ian Csicsek, Saucon Valley – 5-10, 185 senior
Max Shaw, Thomas Jefferson – 6-0, 190 senior
Mason Kordish, Valley View – 5-8, 170 senior
Tavion Banks, Bethlehem Catholic – 5-10, 187 junior
Wide Receiver
Nazir Burnett, Bishop McDevitt – 6-2, 175 senior
Mike Trimbur, South Fayette – 5-11, 180 senior
Dan Deabner, Thomas Jefferson – 6-0, 180 junior
Yusuf Terry, Imhotep Charter – 6-4, 175 senior
Tight End
Demonte Martin, Eastern York – 6-5, 195 senior
Offensive Line
Chris Oliver, Cathedral Prep – 6-4, 293 senior
Tim Weaver, Saucon Valley – 6-5, 285 senior
Dalton Daddona, Bethlehem Catholic – 6-3, 280 senior
Quentin Bloom, Clearfield – 6-0, 307 junior
Shane Murphy, Berks Catholic – 6-4, 270 senior
Marlon Westcott, Imhotep Charter – 6-2, 305 senior
Athlete
Janaasah Boone, Valley View – 6-0, 175 junior
Abdul MacFoy, Berks Catholic – 5-7, 165 junior
Specialist
Ryan Coe, South Fayette – 6-2, 225 senior
DEFENSE
Defensive Line
Joey Scarabino, Cathedral Prep – 6-3, 241 senior
Caleb Rockey, Bellefonte – 6-3, 245 senior
Ryan Bodolus, Pottsgrove – 6-1, 220 senior
David Tomb, Jersey Shore – 6-0, 205 senior
Luke Painton, Berks Catholic – 6-7, 245 senior
Carter Christopher, Bishop McDevitt – 6-3, 285 senior
Linebacker
Brandon George, Berks Catholic – 6-4, 240 senior
Paul Carreras, Bethlehem Catholic – 6-0, 225 senior
Traon Jones, Valley View – 5-5, 155 senior
Hunter O’Connor, Jersey Shore – 6-0, 225 senior
Dray Donley, Bishop McDevitt – 6-0, 215 senior
Defensive Back
Teagan Wilk, Berwick – 5-11, 180 junior
Alex MacKenzie, Conrad Weiser – 6-3, 195 senior
Nehemiah Figueroa, Pottstown – 5-10, 170 senior
Jaden Duplessis, Valley View – 6-1, 175 senior
Athlete
Tykee Smith, Imhotep Charter – 6-0, 190 senior
Kenyon Johnson, West Perry – 5-11, 180 junior
CLASS 2A
Player of the Year: Julian Fleming, Southern Columbia
Coach of the Year: Brandon Phillian, Wilmington
OFFENSE
Quarterback
Stone Hollenbach, Southern Columbia – 6-3, 200 senior
Skyy Moore, Shady Side Academy – 5-11, 185 senior
Aaron Tobias, Penns Valley – 6-2, 195 junior
John Caldwell, Ligonier Valley – 5-10, 150 senior
Logan Pfister, Chestnut Ridge – 6-1, 163 sophomore
Derek Johncour, Avonworth – 6-3, 181 senior
Running Back
Kobe Brish, Schuylkill Haven – 5-9, 200 junior
Gaige Garcia, Southern Columbia – 5-10, 195 junior
Christian Clutter, McGuffey – 6-0, 180 senior
Kam Williams, Steel Valley – 6-0, 185 senior
Kobe Joseph, Sharpsville – 6-3, 220 senior
Wide Receiver
Bryan Dworek, Brookville – 5-11, 175 senior
Aaron Tutino, Ligonier Valley – 5-11, 170 senior
Julian Fleming, Southern Columbia – 6-3, 215 junior
Cabe Park, Brookville – 5-9, 165 senior
Tight End
Logan Snyder, Penns Valley – 6-2, 200 junior
Offensive Line
Ja’Quay Hubbard, Sharpsville – 6-6, 315 senior
Austin Homan, Schuylkill Haven – 6-0, 243 senior
Troy Donlan, Southern Columbia – 6-0, 260 senior
Dylan Dininny, Richland – 6-5, 255 senior
Oak Six, Southern Columbia – 6-3, 265 senior
Athlete
Ryan Ripka, Penns Valley – 5-8, 160 senior
Aidan Houser, Wellsboro – 5-9, 165 junior
Specialist
Zane Puhala, Brockway – 5-10, 175 senior
DEFENSE
Defensive Line
Michael Hood, Mount Carmel – 6-0, 200 senior
Jimmy Reed, Wilmington – 6-2, 225 senior
Collin Instone, Richland – 6-3, 260 senior
Jordan Gray, Wilmington – 6-1, 235 senior
Harris Kohl, York Catholic – 6-0, 200 senior
Hunter Brown, Wellsboro – 6-4, 220 senior
Linebacker
Cal Haladay, Southern Columbia – 6-1, 190 junior
Colton Richards, Wilmington – 6-2, 270 senior
Todd Hill, Steel Valley – 5-10, 225 senior
Max Tillett, Southern Columbia – 6-0, 190 junior
Garrett David, North Penn-Mansfield – 6-3, 225 senior
Jarred Kohl, York Catholic – 6-1, 205 senior
Defensive Back
Cameron Marett, Wilmington – 5-8, 175 senior
Macen Akers, Everett – 6-1, 180 senior
Daniel Walker, Washington – 6-3, 210 senior
Daunte Allegretto, Ridgway – 5-8, 145 senior
Athlete
Robert Pontius, Wilmington – 6-4, 195 senior
import requests
from bs4 import BeautifulSoup
import pandas as pd


r = requests.get('https://cumberlink.com/sports/high-school/football/pa-football-writers-all-state-team-class-a-a-and/article_4d286757-a501-5b5b-b3be-cfebc06ef455.html')
soup = BeautifulSoup(r.content, 'html.parser')

new = []
for item in soup.findAll('div', {"class": "subscriber-only"}):
    if '-' in item.text:
        data = [s.strip() for s in item.text.replace('–', ',').split(',')]
        data[-1:] = data[-1].split()
        new.append(data)


df = pd.DataFrame(new, columns=['Name', 'School', 'Height', 'Weight', 'Class'])
df['Year'] = '2018'
df.to_excel('output.xlsx')