Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loop a list and write to .xlsx
#3
(Apr-11-2020, 04:02 PM)Larz60+ Wrote:
Quote:The code run fine but the save method doesn't work as i wanted
This code cannot fetch a webpage as written
what is value of url after line 7?
print it out and see for yourself.
add after line 7:
print(f"url: {url}")

In addition, you need to attach a portion of data.txt (or entire file if small)

I changed the names of the URLs and elements, this part is works fine.

The data.txt looks like this:
sample1
sample2
sample3
sample4


I'm looking for these words on the pages. When he program program fininshed the export.xlsx contains only "sample4" (or the last) related things.
If I stopped it after "sample2" the export.xlsx contains only "sample2" related things.

I think somehow I need get out the df.to_excel from the loop, but when I do this, the export.xlsx doesn't save anything.
Reply


Messages In This Thread
Loop a list and write to .xlsx - by urobee - Apr-11-2020, 03:41 PM
RE: Loop a list and write to .xlsx - by Larz60+ - Apr-11-2020, 04:02 PM
RE: Loop a list and write to .xlsx - by urobee - Apr-11-2020, 04:24 PM
RE: Loop a list and write to .xlsx - by Larz60+ - Apr-11-2020, 09:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to write a code to get a long list of unknown URLs hkynefin 2 2,548 Sep-16-2018, 11:44 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020