|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Bannato
Iscritto dal: Mar 2004
Città: Edimburgo (UK)
Messaggi: 6640
|
esercizio in python...chi mi aiuta?
L'esercizio e' in lingua inglese.
considerata la stringa s s="""IBM rose 1.2% to $81.49 thanks to an upgrade to 'buy' from 'hold' from Citigroup, but Cisco fell 0.2% to $100.02.""" con le regular expressions, come faccio a far apparire le due seguenti cose? -words in quotes -all words which are not numerical amounts Io ho iniziato importando il seguente modulo: from nltk_lite.utilities import re_show Ma poi devo mettere l'effettiva regular expression iniziando ovviamente con: re_show(' bla-bla Qualcuno sa cosa devo mettere al posto del bla-bla Vi prego, son disperato, ho provato di tutto, ma non so dove sbaglio Ultima modifica di Everyman : 25-10-2006 alle 02:11. |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Mar 2003
Messaggi: 545
|
__________________
Linux Registered User Linux Registered Machine |
|
|
|
|
|
#3 | |||
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
http://docs.python.org/lib/module-re.html
Quote:
nel primo caso qualcosa come Codice:
testo = "blablabla"
import re
re.findall("'.*?'", test )
Codice:
testo = "blablabla"
import re
re.findall("'(.*?)'", test )
Quote:
Codice:
import re
re.findall('[a-zA-Z]+',testo)
Quote:
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|||
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:31.



















