Re: BeautifulSoup help !!

2016-10-07 Thread Navneet Siddhant
i was able to almost get the results i require but only half of the info is 
showing up. i.e suppose there are 20 coupons showing on the page but when i 
print them using the container they are in only 5 are printed on the screen.

Also figured out how to write to csv file , but even here only 1 row is being 
written , how do I iterate through all the info which is printed on the screen 
and export them to a csv ? im using 
writerows([object which contains the data])
on the screen only 5 rows are printed and in the csv only 1 row is exported.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: BeautifulSoup help !!

2016-10-06 Thread Navneet Siddhant
I guess I will have to extract data from multiple divs as only extracting data 
from the parent div which has other divs in it with the different data is 
coming up all messed up. Will play around and see if I could get through it. 
Let me clarify once again I dont need complete code , a resource where I could 
find more info about using Beautifulsoup will be appreciated.  Also do I need 
some kind of plugin etc to extract data to csv ? or it is built in python and I 
could simply import csv and write other commands needed ??
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: BeautifulSoup help !!

2016-10-06 Thread Navneet Siddhant
On Thursday, October 6, 2016 at 8:52:18 PM UTC+5:30, Navneet Siddhant wrote:
> So I've just started up with python and an assignment was given to me by a 
> company as an recruitment task.
> 
> I need to web scrap the coupons of all the websites available on 
> http://www.couponraja.in and export it to csv format. 
> The details which I need to be present in the csv are the coupon title , 
> vendor , validity , description/detail , url to the vendor , image url of the 
> coupon.
> 
> I have gone through many tutorials on beautifulsoup and have a beginners 
> understanding of using it. Wrote a code as well , but the problem Im facing 
> here is when i collect info from the divs which contains all those info , Im 
> getting it in with all the html tags and the info is clustered. 
> 
> Code m using :
> 
> import requests
> from bs4 import BeautifulSoup
>  
> url = "https://www.couponraja.in/amazon;
> r = requests.get(url)
> soup = BeautifulSoup(r.content)
> g_data = soup.find_all("div", {"class": "nw-offrtxt"})
> for item in g_data:
> print item.contents
> 
> also will need help on how to export the info to csv format , I just know I 
> need to import csv then write the information to a csv file.
> But not getting through on how to achieve that.
> 
> Any help will be appreciated.

Thanx for the support Steve . N yes you can call me Sid ..  :) . . .. 


I guess I shouldnt have mentioned as this was a recruitment task. If needed I 
can post a screenshot of the mail I got which says I can take help from 
anywhere possible as long as the assignment is done. Wont be simply copying 
pasting the code as question related to the same will be asked in the interview.
I just need a proper understanding as to what I need to do to get the results.
Also how to export the result to csv format.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: BeautifulSoup help !!

2016-10-06 Thread Navneet Siddhant
On Thursday, October 6, 2016 at 9:57:46 PM UTC+5:30, Navneet Siddhant wrote:
> On Thursday, October 6, 2016 at 9:42:47 PM UTC+5:30, Steve D'Aprano wrote:
> > On Fri, 7 Oct 2016 02:30 am, alister wrote:
> > 
> > > On Thu, 06 Oct 2016 08:22:05 -0700, desolate.soul.me wrote:
> > > 
> > >> So I've just started up with python and an assignment was given to me by
> > >> a company as an recruitment task.
> > >>
> > > so by your own admission you have just started with python yet you
> > > consider your self suitable for employment?
> > 
> > What's your problem Alister? Do you think that junior devs aren't allowed to
> > ask for help?
> > 
> > Desolate.Soul.Me has either applied for a job, and their interview test
> > is "do this task using Python", or he's been accepted in a new job, and the
> > same applies.
> > 
> > Whether it's a learning exercise, a test of skill + initiative, or actual
> > work given to a junior developer, Desolate.Soul.Me is perfectly entitled to
> > ask for help.
> > 
> > This isn't some artificially constrained academic homework, with stupidly
> > strict and hypocritical rules about so-called "plagiarism". This is the
> > real world where you take all the help you can get and you shouldn't feel
> > ashamed for asking for help. ESPECIALLY in the open source world, including
> > Python, where one of the community values is to share expertise.
> > 
> > My own employer has hired plenty of junior developers and given them
> > relatively minor tasks to do as a learning exercise. We're not going to
> > trust a junior developer with a critical piece of code, but we might say:
> > 
> > "Scrape this website. Use Python. Here's the Python For Beginners
> > book. Here's the Python documentation, and a few more forums where
> > you can ask for help. If you get stuck, and aren't getting useful
> > answers from the forums, you can ask Lisa. But not today, as she's
> > busy doing a critical release and can't be disturbed."
> > 
> > 
> > P.S. Desolate.Soul.Me, you might be taken a bit more seriously if you give a
> > name, or at least a moniker or nick-name which is easier for others to
> > refer to you by. It doesn't have to be your birthname, or legal name. What
> > do your friends and workmates call you?
> > 
> > 
> > I don't know Beautiful Soup, so I'm afraid I can't help.
> > 
> > 
> > 
> > -- 
> > Steve
> > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> > enough, things got worse.
> 
> Yes ... Im allowed to take help as this group and python forums and other 
> links were suggested to me by them. Have been trying since morning not 
> getting the desired results , posted here as last resort .. and Im ok if I 
> dont find what m seeking.  Though m getting close , lets see what I could 
> achieve.

Btw my institute has referred me for this job in the company who has further 
emailed me with the assignment to complete after which I will have face to face 
interviews. Im still wondering as why I was told to do a python assignment when 
nowhere in my CV i have mentioned about python nor it was taught to us in the 
curriculum 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: BeautifulSoup help !!

2016-10-06 Thread Navneet Siddhant
On Thursday, October 6, 2016 at 9:42:47 PM UTC+5:30, Steve D'Aprano wrote:
> On Fri, 7 Oct 2016 02:30 am, alister wrote:
> 
> > On Thu, 06 Oct 2016 08:22:05 -0700, desolate.soul.me wrote:
> > 
> >> So I've just started up with python and an assignment was given to me by
> >> a company as an recruitment task.
> >>
> > so by your own admission you have just started with python yet you
> > consider your self suitable for employment?
> 
> What's your problem Alister? Do you think that junior devs aren't allowed to
> ask for help?
> 
> Desolate.Soul.Me has either applied for a job, and their interview test
> is "do this task using Python", or he's been accepted in a new job, and the
> same applies.
> 
> Whether it's a learning exercise, a test of skill + initiative, or actual
> work given to a junior developer, Desolate.Soul.Me is perfectly entitled to
> ask for help.
> 
> This isn't some artificially constrained academic homework, with stupidly
> strict and hypocritical rules about so-called "plagiarism". This is the
> real world where you take all the help you can get and you shouldn't feel
> ashamed for asking for help. ESPECIALLY in the open source world, including
> Python, where one of the community values is to share expertise.
> 
> My own employer has hired plenty of junior developers and given them
> relatively minor tasks to do as a learning exercise. We're not going to
> trust a junior developer with a critical piece of code, but we might say:
> 
> "Scrape this website. Use Python. Here's the Python For Beginners
> book. Here's the Python documentation, and a few more forums where
> you can ask for help. If you get stuck, and aren't getting useful
> answers from the forums, you can ask Lisa. But not today, as she's
> busy doing a critical release and can't be disturbed."
> 
> 
> P.S. Desolate.Soul.Me, you might be taken a bit more seriously if you give a
> name, or at least a moniker or nick-name which is easier for others to
> refer to you by. It doesn't have to be your birthname, or legal name. What
> do your friends and workmates call you?
> 
> 
> I don't know Beautiful Soup, so I'm afraid I can't help.
> 
> 
> 
> -- 
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.

Yes ... Im allowed to take help as this group and python forums and other links 
were suggested to me by them. Have been trying since morning not getting the 
desired results , posted here as last resort .. and Im ok if I dont find what m 
seeking.  Though m getting close , lets see what I could achieve.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: BeautifulSoup help !!

2016-10-06 Thread Navneet Siddhant
On Thursday, October 6, 2016 at 9:00:21 PM UTC+5:30, alister wrote:
> On Thu, 06 Oct 2016 08:22:05 -0700, desolate.soul.me wrote:
> 
> > So I've just started up with python and an assignment was given to me by
> > a company as an recruitment task.
> >
> so by your own admission you have just started with python yet you 
> consider your self suitable for employment?
> 
> 
> -- 
> "Unibus timeout fatal trap program lost sorry"
> - An error message printed by DEC's RSTS operating system for the PDP-11


yup ... training will be provided further , all they want to confirm is atleast 
I have basic knowledge of how the language works and they wont have to tell me 
how to install python on the system or any further extensions to it. Im not 
quite as to why they provided me with this assignment when my cv clearly states 
that im good with .net and not python.

I hope you could help here and not just trolling around.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problems with curses

2008-07-20 Thread Siddhant
On Jul 13, 6:22 pm, Clay Hobbs [EMAIL PROTECTED] wrote:
  On Sat, 12 Jul 2008 20:49:56 -0400, Clay Hobbs wrote:

         Unfortunately, the error message isn't very helpful.

  But it would be helpful to tell it.  If you get exceptions, always
  copy'n'paste the traceback here.  People might know what the exception
  means and share their wisdom.

 Here is the error message:

 Traceback (most recent call last):
   File ./text_adventure.py, line 25, in module
     curses.wrapper(main)
   File /usr/lib/python2.5/curses/wrapper.py, line 44, in wrapper
     return func(stdscr, *args, **kwds)
   File ./text_adventure.py, line 19, in main
     stdscr.scroll(3)
 _curses.error: scroll() returned ERR

 -- Ratfink

You need to put a stdscr.scrollok(True) in the beginning. That should
avoid the exception.
-Siddhant
--
http://mail.python.org/mailman/listinfo/python-list


Confusion regarding the readline module

2008-05-06 Thread Siddhant
Hi!
I am having some doubts related to the readline module. I hope someone
could clear them.
1. What exactly does the readline.get_line_buffer() function do? Does
it return whatever is the current input by the user? If yes, then can
I use it to check the current inputs of the user and base the next-
word completion against whatever the user has entered so far? There
wasn't much documentation on it, and a lot of googling couldn't help
much. :(
2. Related to the completer function, what is meant by returning the
stateth completion for text? Is the completer function called
everytime (for all possible values of state) when I press the Tab
key? When/How is it called?

Basically, I need to define a completer function, that should take
into consideration whatever the user has entered so far, and complete
the next word accordingly. The same way as a cd /some/file is
meaningless.
--
http://mail.python.org/mailman/listinfo/python-list


implementing tab completion using python

2008-03-22 Thread Siddhant
Hi.
How can I implement a tab-completing code using Python?
Like for example, I want to design a simple shell (using Python, of
course), which could support tab completion as well. How do I go about
it?
Thanks.
Siddhant
-- 
http://mail.python.org/mailman/listinfo/python-list


tab completion?

2008-03-04 Thread Siddhant
Hi people.
I was just wondering if a tab-completion feature in python command
line interface would be helpful?
If yes, then how can I implement it?
Thanks,
Siddhant
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tab completion?

2008-03-04 Thread Siddhant
Yes. Almost what I wanted. Thanks. :)
-- 
http://mail.python.org/mailman/listinfo/python-list