hai Hello hai
=> ["Hello", " ", " ", "Hello", " ", "hai"]
re.split(r"\b", string)
a='ali am' a=[x for x in a.split(' ')]
Don't wanna use any library like Just wanna use crazy algorithm here lol: a1='your crazy text lol' a=list(a1) v,sum=[],'' for i in a: if i!=' ':sum+=i else: v.append(sum),v.append(' ') sum='' v=list(filter(lambda x: x!='',v)) v.append(a1.split()[-1]) print(v)
https://t.me/c/1111136772/186949
1. Use telegram mono formatting to format your code sample. 2. re isn't a library but a module in the standard library. 3. No need to do a = list(a1) as strings are iterable in python 4. The part with the filter is not necessary as when you iterate a, no character i will be empty.
The use re
nah didnt used re
i think code you shared is good, but its not readable mainly because you didnt formatted and shared raw text
To post more than a few lines of code, use a pastebin like: * dpaste.org * linkode.org * bin.kv2.dev * hastebin.com If you are stuck in a terminal, you can use ix.io or paste.rs to paste from the CLI: <command to print output> |& curl -F 'f:1=<-' ix.io <command to print output> |& curl --data-binary @- https://paste.rs
Обсуждают сегодня