![]() |
Converting a patterned string or text into excel table - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Converting a patterned string or text into excel table (/thread-21514.html) |
Converting a patterned string or text into excel table - soup1987 - Oct-02-2019 Dear All, This is my first post and im still very new to Python so i will appreciate all the patience and help i can get! I have made a webscraper, the output of the scraper is a patterned text that I need to convert into an excel table example of the output i got from the webscraper is: "A" : "131", "B" :"12234", "C" : "ALPHA", "D" : "122" "A" : "39" , "B" : "9994", "C" : "ROMEO", "D" :"12367, "A" : "551", "B" :"13334", "C" : "BETA", "D" : "622 "A" : "679" , "B" : "4234", "C" : "XYZ", "D" :"999" .........etc....... I want to convert the above output into a table as such and then feed the above table into an excel file.Can you please advise which libraries and programming statements/codes i can use to achieve the above? below is the code i have written so far for your reference: from selenium import webdriver import time driver= webdriver.Chrome(executable_path="C:.....Desktop/chromedriver.exe") driver.get("www.###.com") time.sleep(3) driver.refresh() #ive added a refresh statement so the links in the AJAX(XHR) can be accessed without being blocked time.sleep(3) driver.get ("www.###.com") print (driver.page_source) #this generates the output i have listed aboveBest Regards, Soup RE: Converting a patterned string or text into excel table - Larz60+ - Oct-03-2019 what you have is essentially a .csv file. Double clicking on the file, and opening as an excel spreadsheet should be all you need. If you have to do it programmatically for an assignment, it can be done using pandas, or any number of available packages, see: https://pypi.org/search/?q=excel |