On Mon, Nov 14, 2011 at 11:56 AM, lina wrote:
> On Mon, Nov 14, 2011 at 6:28 AM, Andreas Perstinger
> wrote:
>> On 2011-11-11 14:44, lina wrote:
>>>
>>> You are right, I did not think of this parts before. and actually the
>>> initiative wish was to find possible paths, I mean, possible
>>> subst
On Mon, Nov 14, 2011 at 6:28 AM, Andreas Perstinger
wrote:
> On 2011-11-11 14:44, lina wrote:
>>
>> You are right, I did not think of this parts before. and actually the
>> initiative wish was to find possible paths, I mean, possible
>> substrings, all possible substrings. not the longest one, but
On 2011-11-11 16:53, Jerry Hill wrote:
There's nothing wrong with writing your own code to find the longest common
substring, but are you aware that python has a module in the standard
library that already does this? In the difflib module, the SequenceMatcher
class can compare two sequences and
On 2011-11-11 14:44, lina wrote:
You are right, I did not think of this parts before. and actually the
initiative wish was to find possible paths, I mean, possible
substrings, all possible substrings. not the longest one, but at
least bigger than 3.
I had some time today and since you have chan
On 11/13/2011 08:06 AM, lina wrote:
Finally, if I am not wrong again, I feel I am kinda of starting
figuring out what's going on. Why it's None.
The main mistake here I use result = result.append(something)
the "="
I checked the print(id(result)) and print(id(result.append()),
For the NoneTyp
On Sun, Nov 13, 2011 at 12:40 AM, Andreas Perstinger
wrote:
> On 2011-11-12 16:24, lina wrote:
>>
>> Thanks, ^_^, now better.
>
> No, I'm afraid you are still not understanding.
>
>> I checked, the sublist (list) here can't be as a key of the results
>> (dict).
>
> "result" isn't a dictionary. It
On Sat, Nov 12, 2011 at 11:40 AM, Andreas Perstinger <
andreas.perstin...@gmx.net> wrote:
> On 2011-11-12 16:24, lina wrote:
>
>> Thanks, ^_^, now better.
>>
>
> No, I'm afraid you are still not understanding.
>
>
> I checked, the sublist (list) here can't be as a key of the results
>> (dict).
>>
On 2011-11-12 16:24, lina wrote:
Thanks, ^_^, now better.
No, I'm afraid you are still not understanding.
I checked, the sublist (list) here can't be as a key of the results (dict).
"result" isn't a dictionary. It started as an empty list and later
becomes a null object ("NoneType").
You
On Sat, Nov 12, 2011 at 10:57 PM, Dave Angel wrote:
> On 11/12/2011 09:48 AM, lina wrote:
>>
>> On Sat, Nov 12, 2011 at 9:22 PM, Dave Angel wrote:
>>>
>>> On 11/12/2011 03:54 AM, lina wrote:
The one I tried :
if longest>= 2:
sublist=L1
On 11/12/2011 09:48 AM, lina wrote:
On Sat, Nov 12, 2011 at 9:22 PM, Dave Angel wrote:
On 11/12/2011 03:54 AM, lina wrote:
The one I tried :
if longest>= 2:
sublist=L1[x_longest-longest:x_longest]
result=result.append(sublist)
On Sat, Nov 12, 2011 at 9:22 PM, Dave Angel wrote:
> On 11/12/2011 03:54 AM, lina wrote:
>>
>>
>> The one I tried :
>> if longest>= 2:
>> sublist=L1[x_longest-longest:x_longest]
>> result=result.append(sublist)
>> if subl
On 11/12/2011 03:54 AM, lina wrote:
The one I tried :
if longest>= 2:
sublist=L1[x_longest-longest:x_longest]
result=result.append(sublist)
if sublist not in sublists:
sublists.append(sublis
Sorry I finished last email in two different time,
while:
> INFILEEXT=".doc"
>
>
> def CommonSublist(L1, L2):
> sublist=[]
> sublists=[]
> result=[]
> M = [[0]*(1+len(L2)) for i in range(1+len(L1))]
> longest, x_longest = 0, 0
> for x in range(1,1+len(L1)):
> for y in ra
On Sat, Nov 12, 2011 at 5:49 AM, Andreas Perstinger
wrote:
> First, just a little rant :-)
> It doesn't help to randomly change some lines or introduce some new concepts
> you don't understand yet and then hope to get the right result. Your chances
> are very small that this will be succesful.
> Y
First, just a little rant :-)
It doesn't help to randomly change some lines or introduce some new
concepts you don't understand yet and then hope to get the right result.
Your chances are very small that this will be succesful.
You should try to understand some basic concepts first and build on
I wrote a crazy one, to find the common group:
Please jump to the end part of this code:
https://docs.google.com/open?id=0B93SVRfpVVg3MDUzYzI1MDYtNmI5MS00MmZkLTlmMTctNmE3Y2EyYzIyZTk2
Thanks again,
___
Tutor maillist - Tutor@python.org
To unsubscrib
There's nothing wrong with writing your own code to find the longest common
substring, but are you aware that python has a module in the standard
library that already does this? In the difflib module, the SequenceMatcher
class can compare two sequences and extract the longest common sequence of
el
On Fri, Nov 11, 2011 at 9:10 PM, Andreas Perstinger
wrote:
> On 2011-11-11 05:14, lina wrote:
>>
>> def LongestCommonSubstring(S1, S2):
>> M = [[0]*(1+len(S2)) for i in xrange(1+len(S1))] ## creat 4*5 matrix
>> longest, x_longest = 0, 0
>> for x in xrange(1,1+len(S1)):
Based on former advice, I made a correction/modification on the below code.
1] the set and subgroup does not work, here I wish to put all the
subgroup in a big set, the set like
$ python3 LongestCommonSubstring.py | uniq
{"1',"}
{"1', "}
{"1', '"}
{"1', '8"}
{"1', '82"}
{"1', '82'"}
{"1', '82',"
On Fri, Nov 11, 2011 at 9:10 PM, Andreas Perstinger
wrote:
> On 2011-11-11 05:14, lina wrote:
>>
>> def LongestCommonSubstring(S1, S2):
>> M = [[0]*(1+len(S2)) for i in xrange(1+len(S1))] ## creat 4*5 matrix
>> longest, x_longest = 0, 0
>> for x in xrange(1,1+len(S1)):
On 2011-11-11 05:14, lina wrote:
def LongestCommonSubstring(S1, S2):
M = [[0]*(1+len(S2)) for i in xrange(1+len(S1))] ## creat 4*5 matrix
longest, x_longest = 0, 0
for x in xrange(1,1+len(S1)): ## read each row
for y in xrange(1,1+len(S2)): ## r
#!/usr/bin/python3
import os.path
xrange = range
c=['71', '82', '80', '70', '84', '56', '58', '34', '77', '76', '61',
'76', '34', '76', '58', '34', '56', '61', '65', '82', '65', '80',
'65', '82', '80', '82', '65', '82', '61', '80', '82', '65', '61',
'63', '65', '70', '80', '71', '34', '71', '
On Fri, Nov 11, 2011 at 1:23 AM, Walter Prins wrote:
> Hi,
>
> On 10 November 2011 16:23, lina wrote:
>>
>> def LongestCommonSubstring(S1, S2):
>> M = [[0]*(1+len(S2)) for i in range(1+len(S1))]
>> longest, x_longest = 0, 0
>> for x in range(1,1+len(S1)):
>> fo
On Fri, Nov 11, 2011 at 1:21 AM, Peter Otten <__pete...@web.de> wrote:
> lina wrote:
>
>> Hi,
>>
>> I tested the one from
>>
> http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring
>>
>> mainly:
>>
>> #!/usr/bin/python3
>>
>> a=['1','2','3','7']
>>
>> b=['2','3','7'
Hi,
On 10 November 2011 16:23, lina wrote:
> def LongestCommonSubstring(S1, S2):
>M = [[0]*(1+len(S2)) for i in range(1+len(S1))]
>longest, x_longest = 0, 0
>for x in range(1,1+len(S1)):
>for y in range(1,1+len(S2)):
>M[x][y] = M[x-
lina wrote:
> Hi,
>
> I tested the one from
>
http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring
>
> mainly:
>
> #!/usr/bin/python3
>
> a=['1','2','3','7']
>
> b=['2','3','7']
>
> def LongestCommonSubstring(S1, S2):
> M = [[0]*(1+len(S2)) for i in
Hi,
I tested the one from
http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Longest_common_substring
mainly:
#!/usr/bin/python3
a=['1','2','3','7']
b=['2','3','7']
def LongestCommonSubstring(S1, S2):
M = [[0]*(1+len(S2)) for i in range(1+len(S1))]
longest, x_longes
27 matches
Mail list logo