Click here to Skip to main content
15,891,853 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear all,

I am looking for guideline to read data from websitephoton . & load into csv file. Whenever new supplier selection or typesection change data should recorded into same excel with new sheet. Can some guide how to get started using python
This code to develop for database. Is there any easy method to do it will be appreciable.

http://www.photon.info/photon_site_db_solarmodule_en.photon[^]
Posted
Comments
Patrice T 3-Nov-15 23:13pm    
Question not clear, give details

1 solution

Hi, I'm so sorry, what specifically are you looking to do? Your instructions are a bit unclear.

Here is some python 3.4 code that I use to pull data from websites. It basically pulls data from a site and then saves it as a txt file. I have changed the code to something for .csv

It will be incomplete and need proofing and modifying but it should get the basic beginnings of getting data in csv for you.

SQL
savePath = 'C:/' + # whereever you save data
z = [] #list of website sub domains
for x in range (0, len(z)):
    print('Currently Pulling', z[x])
    urlToVisit = 'http://www.photon.info/' + z[x]
    websiteFile =[]

    sourceCode = urllib.request.urlopen(urlToVisit).read().decode()
    splitSource = sourceCode.split('\n')
    for eachLine in splitSource:
    '''' do your thing ''''
        
    completeName = os.path.join(savePath, z[x]+'.csv')
    with open(completeName, 'w') as file:
          for eachLine in websiteFile:
              file.write("{}\n".format(eachLine))
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900