Another way of doing this might be to use the module difflib to
calculate the differences. It has a sequence matcher under it which
has the function get_matching_blocks
difflib is included with python.
On May 29, 2:02 pm, Chris <[EMAIL PROTECTED]> wrote:
> On May 29, 10:36 am, loial <[EMAIL PROT
they caused the test case to fail on this.
Weird behavior :/
Thanks for your time Gerard and thanks to everyone else too.
On May 28, 5:11 pm, Gerard Flanagan <[EMAIL PROTECTED]> wrote:
> On May 28, 1:48 pm, afrobeard <[EMAIL PROTECTED]> wrote:
>
>
>
> > The fol
The following following code fails with the failiure:-
File "test.py", line 27, in __main__.sanitize_number
Failed example:
sanitize_number('0321-4683113')
Expected:
'03214683113'
Got:
'03214683113'
Expected and Got looks the same. The value should verify. What am I
doing wrong her
On May 14, 9:13 pm, Rajarshi <[EMAIL PROTECTED]> wrote:
> Thanks to the all posters. This will be very useful!
No Problem :). Let me know if you need any code snippets.
P.S. I wouldn't mind working with you to prepare introductory material
and examples for beginners if it becomes public property.
l.__delslice__(0,len(l)) is an expression as it returns None which is
a value
On May 16, 4:23 am, castironpi <[EMAIL PROTECTED]> wrote:
> On May 15, 6:07 pm, afrobeard <[EMAIL PROTECTED]> wrote:
>
>
>
> > The following proposed solution is not intended to be a so
On May 15, 6:07 pm, afrobeard <[EMAIL PROTECTED]> wrote:
>
>
>
> > The following proposed solution is not intended to be a solution, it
> > goes completely against the zen of python. [Type import this into the
> > python command interpreter]
>
> > I brought it
The following proposed solution is not intended to be a solution, it
goes completely against the zen of python. [Type import this into the
python command interpreter]
I brought it down to two lines:-
l = range(6)
[1 if b!=4 else l.__delslice__(0,len(l)) for b in l][:-1]
itertools would still be
Arnaud's code wont work if self.opt1 is None, an empty list, an empty
tuple, False, etc, because all these evaluate to false. They wont
print the internal state of these variables. [Just an informational
notice, this may be the behavior you expect]
Secondly, I'm not sure if you know the variable n
First of all, it would be better to use:-
ftp.storlines("STOR " + remoteFileName, open(localFileName, "rb"))
rather than:-
ftp.storlines("STOR" + filename, file(filename))
Since the Python Documentation has this to say for open(): [Although ]
When opening a file, it's preferable to use open()
If I were you, I'd show them actual code and how easy it is to get
things done. Showing them how to implement a GTalk Bot[http://
code.google.com/p/pygtalkrobot/] or how to build simple arcade games
with PyGame[http://www.pygame.org/news.html] would harbor much more
interest in my opinion because i
range(50,100,2) returns a list of numbers starting from 50 and less
than 100 with a step size of 2.
list() takes any iterable datatype and converts it into a list.
e.g. list((1, 2, 3)) would return [1,2,3]
& list([1, 2]) would return [1,2]
In this case there is no point of calling range within l
If you are familiar to C++ or a similar language, the concept of the
this pointer might not be alien to you. self in this context is
basically a reference to the class itself. Hence self.file is creating
a class member and setting to the input from file.
As Gary pointed out, during initialization,
12 matches
Mail list logo