Re: [Python-Dev] Unicode decode exception

2014-11-30 Thread balaji marisetti
The default encoding is "UTF-8". It works if I do: with open("filename", errors="ignore") as f: So I think Python2, by default, ignores all errors whereas Python3 doesn't On 1 December 2014 at 01:49, Chris Angelico wrote: > On Sun, Nov 30, 2014

Re: CommandLine Option in Python for filtering values from Column

2014-04-10 Thread balaji marisetti
> An alternative is to grab docopt from pypi, it's awesome :) Some time back, I watched a video about that module but, later, I forgot its name. Thanks for reminding me of that module. On 10 April 2014 13:57, Mark Lawrence wrote: > On 10/04/2014 06:16, balaji marisetti wrote: >&g

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-09 Thread balaji marisetti
There was long thread discussing flattening of a list on this list :). See the link below. https://mail.python.org/pipermail/python-list/2014-March/669256.html On 10 April 2014 10:44, length power wrote: x=["a","b",["c","d"],"e"] y=x[2] y > ['c', 'd'] x.insert(2,y[0]) x

Re: CommandLine Option in Python for filtering values from Column

2014-04-09 Thread balaji marisetti
sys.argv is itself a list. You can directly access the `quality` field as sys.argv[2]. quality = int(sys.argv[2]) However, if you want to use more command line options, then using `argparse` module is better than accessing arguments using `sys.argv`. Import `argparse` module and create

Python3 html.parser

2014-03-18 Thread balaji marisetti
Hi, I'm trying to parse a pice of HTML code using `html.parser` in Python3. I want to find out the offset of a particular end tag (let's say ) and then stop processing the remaining HTML code immediately. So I wrote something like this. [code] def handle_endtag(self, tag): if tag == mytag: