You are not logged in.
Pages: 1
im trying to split a string with this form (the string is from a japanese dictionary file with mulitple definitions in english for each japanese word)
str1 [str2] / (def1, ...) (1) def2 / def3 / .... (2) def4/ def5 ... /
the varibles i need are str*, def*.
sometime the (1) and (2) are not included - they are included only if the word has two different meanings
"..." means that there are some times more then two definitions per meaning.
im trying to use the re.split() function but with no luck.
Is this possible with python, or am i dreamin!?
All the best,
.
Offline
Try breaking down your problem first.
First, check to see if the string include (1) or (2), then act accordingly on those logical branch conditions..
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
I would do it case-by-case, as it would get too complicated otherwise...
use re.search(pattern).groups to get the matches
Offline
thanks for the help.
Im impressed how well python handles unicode characters, it wasnt so hard to do after all!
Offline
Pages: 1