Re: [Tutor] How parse files in function of number of lines

2014-05-28 Thread Alan Gauld
On 28/05/14 20:16, jarod...@libero.it wrote: Dear all! I have two example files: tmp.csv: namevalue root mark34 yes tmp2.csv namevalue root I understood down to here. I want to print a different text if I have more than one row and if I have only one row. This is not

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread wesley chun
I'm not going to add too much more to all the replies here already, but one of my students did record a quick <6-minute video in one of my courses where i explained generators. hopefully you find it useful! It's about halfway down the page at http://cyberwebconsulting.com. (Also for those learning

[Tutor] How parse files in function of number of lines

2014-05-28 Thread jarod...@libero.it
Dear all! I have two example files: tmp.csv: namevalue root mark34 yes tmp2.csv namevalue root I want to print a different text if I have more than one row and if I have only one row. My code is this: with open("tmp.csv") as p: header =p.next() for i in p: p

Re: [Tutor] HTML Parsing

2014-05-28 Thread Dave Angel
"Mitesh H. Budhabhatti" Wrote in message: (please post in text email, not html. Doesn't matter for most people on this particular message, but it's the polite thing to do) I see others have answered the programming question, but there's a separate one. What is the license of the particul

Re: [Tutor] HTML Parsing

2014-05-28 Thread Danny Yoo
> I am using Python 3.3.3 on Windows 7. I would like to know what is the best > method to do HTML parsing? For example, I want to connect to www.yahoo.com > and get all the tags and their values. For this purpose, you may want to look at the APIs that the search engines provide, rather than try

Re: [Tutor] pipes and redirecting

2014-05-28 Thread Adam Gold
> On 27/05/14 21:01, Adam Gold wrote: > >> "dd if=/home/adam/1 bs=4k conv=noerror,notrunc,sync | pbzip2 > 1.img.bz2" >> >> The first thing I do is break it into two assignments > > And that's the start of the problem because it should be three: > The first command, the second command and the outp

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread Hilton Fernandes
Dear all, i'd like to thank every answer in this list. Alan Gauld is a fine writer of excellent introductory material on Pyton, and so are a few other members of this list. So, it is always enlightening to read what you all write. Keep up the good work. All the best, hilton On Wed, May 28, 20

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread Alan Gauld
On 28/05/14 11:52, Degreat Yartey wrote: This means that '...' should generally contain a manipulator then yield generates from where it stopped...*getting it* It would help if you deleted the irrelevent bits so we can see which '...' you mean. I'm guessing it was this comment, right at the

Re: [Tutor] HTML Parsing

2014-05-28 Thread Alan Gauld
On 28/05/14 11:42, Mitesh H. Budhabhatti wrote: Hello Friends, I am using Python 3.3.3 on Windows 7. I would like to know what is the best method to do HTML parsing? For example, I want to connect to www.yahoo.com and get all the tags and their values. The standard lib

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread Degreat Yartey
This means that '...' should generally contain a manipulator then yield generates from where it stopped...*getting it* Thanks for the explanation though! Its seems so simple to digest. Thank you... On May 28, 2014 1:09 AM, "Danny Yoo" wrote: > On Tue, May 27, 2014 at 12:27 PM, Degreat Yartey >

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread Degreat Yartey
I am completely new to programming! On May 27, 2014 10:54 PM, "R. Alan Monroe" wrote: > > I need an explanation so simple as using the expression 'print ()', in > this case 'yield'. > > Python 2.6 here! > > Ever write any C programs with static variables? Generators can be > explained in those te

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread Degreat Yartey
I really love this explanation... that means functions just run till it finishes its duty, then return...and generators just generate one at a time until the 'for' statement asks for __next__(). On May 28, 2014 8:37 AM, "Cameron Simpson" wrote: > On 27May2014 15:27, Degreat Yartey wrote: > >> I

[Tutor] HTML Parsing

2014-05-28 Thread Mitesh H. Budhabhatti
Hello Friends, I am using Python 3.3.3 on Windows 7. I would like to know what is the best method to do HTML parsing? For example, I want to connect to www.yahoo.com and get all the tags and their values. Thanks. Warm Regards, *Mitesh H. Budhabhatti* Cell# +91 99040 83855 __

Re: [Tutor] pipes and redirecting

2014-05-28 Thread Cameron Simpson
On 27May2014 21:01, Adam Gold wrote: I'm trying to run the following unix command from within Python as opposed to calling an external Bash script (the reason being I'm doing it multiple times within a for loop which is running through a list): "dd if=/home/adam/1 bs=4k conv=noerror,notrunc,syn

Re: [Tutor] I am having difficulty grasping 'generators'

2014-05-28 Thread Cameron Simpson
On 27May2014 15:27, Degreat Yartey wrote: I am studying python on my own (i.e. i am between the beginner and intermediate level) and i haven't met any difficulty until i reached the topic 'Generators and Iterators'. I need an explanation so simple as using the expression 'print ()', in this case

Re: [Tutor] pipes and redirecting

2014-05-28 Thread Alan Gauld
On 27/05/14 21:01, Adam Gold wrote: "dd if=/home/adam/1 bs=4k conv=noerror,notrunc,sync | pbzip2 > 1.img.bz2" The first thing I do is break it into two assignments And that's the start of the problem because it should be three: The first command, the second command and the output file. ddIf