How to find the word 'python' in string 'pythonpythonpythonpyth'?

58 views
Skip to first unread message

Віталій Лисенко

unread,
Nov 5, 2014, 11:16:00 AM11/5/14
to django...@googlegroups.com
How to find the word 'python' in string 'pythonpythonpythonpyth'?

Rafael E. Ferrero

unread,
Nov 5, 2014, 11:23:05 AM11/5/14
to django...@googlegroups.com
a.find('python')


--
Rafael E. Ferrero

2014-11-05 8:16 GMT-03:00 Віталій Лисенко <lordv...@gmail.com>:
How to find the word 'python' in string 'pythonpythonpythonpyth'?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5cb8f985-b3aa-4df7-aed7-6a1859e7a87c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Віталій Лисенко

unread,
Nov 5, 2014, 11:43:38 AM11/5/14
to django...@googlegroups.com
Sorry. I asked the question incorrectly.
Example.
I line 'pythonpythonpyth'. How do I know which word is the foundation line?.
Other examples:
"DOLORIUMD" --> rigth answer DOLORIUM
"HELLOL" --> HELLOL
"thewordword" --> thewordword

I need to know whether the word in the text is repeated and get it. This will be the key.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/xNEunhaILUI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--
Best regards Vitaly Lysenko from village Markove (Ukraine)

Denis Darii

unread,
Nov 5, 2014, 11:50:52 AM11/5/14
to django...@googlegroups.com
Vitaly feel free to look on https://www.python.org/ for a solution to your issue and please keep only django related questions in this "Django users" group.
Thank you.
Denis.


For more options, visit https://groups.google.com/d/optout.



--
I'm using Linux because i'm freedom dependent.

Russell Keith-Magee

unread,
Nov 6, 2014, 12:29:52 AM11/6/14
to Django Users

Actually - I'd suggest that the Python mailing list isn't the right place either.

It sounds like the problem you're describing is called the Longest Repeated Substring problem:


The solution to this problem is well known, and O(n) - you use a suffix tree. Python doesn't have a built-in suffix tree (that I'm aware of), but it's a relatively simple task to build one using primitives that Python provides. 

Yours,
Russ Magee %-)

m1chael

unread,
Nov 6, 2014, 1:34:03 AM11/6/14
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages