Python Forum
getting rid of [''] while print
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getting rid of [''] while print
#11
(Aug-28-2019, 12:31 PM)buran Wrote:
(Aug-28-2019, 12:24 PM)zarize Wrote: and it doesn't work... it returns something about tab
what does it return? Probably error that you mix tab with spaces?

TabError: inconsistent use of tabs and spaces in indentation

NVM! it works! it shouldnt be in the same "tab" like function "for"
i just moved it to start of the new line! :) thank you!! :D


#edit

Ok... it works.. but for first only i guess.. 1, first result
Reply
#12
(Aug-28-2019, 12:35 PM)zarize Wrote: TabError: inconsistent use of tabs and spaces in indentation
This is not indentation errror, probably you had it too. This means you mix tabs and spaces for indentation. Even if the indentation levels are correct it will still error.
you should use spaces. make your IDE (in settings) to convert tab to 4 spaces.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#13
(Aug-28-2019, 12:41 PM)buran Wrote:
(Aug-28-2019, 12:35 PM)zarize Wrote: TabError: inconsistent use of tabs and spaces in indentation
This is not indentation errror, probably you had it too. This means you mix tabs and spaces for indentation. Even if the indentation levels are correct it will still error.
you should use spaces. make your IDE (in settings) to convert tab to 4 spaces.

you are totally right... problem solved so far!!

thank you !! <3
Reply
#14
(Aug-28-2019, 12:24 PM)zarize Wrote: and it doesn't work... it returns something about tab
https://python-forum.io/misc.php?action=help&hid=19
Recommended Tutorials:
Reply
#15
(Aug-28-2019, 12:42 PM)metulburr Wrote:
(Aug-28-2019, 12:24 PM)zarize Wrote: and it doesn't work... it returns something about tab
https://python-forum.io/misc.php?action=help&hid=19

well noted :P

for section in soup.find_all(class_='c-pa-info'):
    dlink = section.find('a', {'href':'c-pa-link link_AB'}).text.strip()
    stype = section.find('a', {'class':'c-pa-link link_AB'}).text.strip()
    sbathrooms = section.find('div', {'class':'c-pa-criterion'}).text.strip()
    sprice = section.find('span', {'class':'c-pa-cprice'}).text.strip()
    cc = section.find('span', {'class':'c-pa-sprice'}).text.strip()
    sneighborhood = section.find('div', {'class':'c-pa-city'}).text.strip()
    print(dlink)
this is my current state... as you can see i am trying to solve how to get direct link to an x offer.. any tip? :P
i am trying to print(dlink)

error:
Traceback (most recent call last):
  File "seloger.py", line 44, in <module>
    dlink = section.find('a', {'href':'c-pa-link link_AB'}).get_text().strip()
TypeError: 'NoneType' object is not callable
#EDIT
found answer :D
dlink = section.find('a').get('href')
Reply


Forum Jump:

User Panel Messages

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