0

How can i avoid punctuation??

words = input().split(" ") for word in words: word = word[1::]+word[0]+'ay' print(word,end = " ")

10th Mar 2020, 5:38 AM
Vikas Karyani
Vikas Karyani - avatar
13 Antworten
10th Mar 2020, 6:25 AM
Oma Falk
Oma Falk - avatar
+ 4
the filter(function, iterable) filters all chars that are not punct. It returns a filter expression that is reconverted to a string. It is a bit runaway but worth to become familiar with it.
10th Mar 2020, 6:35 AM
Oma Falk
Oma Falk - avatar
+ 2
Instead of split(), use RegEx https://www.sololearn.com/learn/9704/?ref=app
10th Mar 2020, 5:44 AM
Gordon
Gordon - avatar
+ 2
is there any?
10th Mar 2020, 6:01 AM
Oma Falk
Oma Falk - avatar
+ 2
if input is aha, oho, soso? input().split(",")
10th Mar 2020, 6:07 AM
Oma Falk
Oma Falk - avatar
+ 2
For delete ".,!? ..." and "1234..." you can use check by .isalpha Or you can use: word=word.replace('.','')
10th Mar 2020, 9:26 PM
Николай
+ 1
text = input('') lis=text.split() for sam in lis: length=len(sam) x,y=sam[1:length],sam[0] print(x+y+'ay',end=' ') Try this this may help
11th Mar 2020, 1:49 PM
Aryan Nair
Aryan Nair - avatar
+ 1
from string import punctuation a ='hello world; today is a nice day .!' a = ''.join([letter for letter in a if letter not in punctuation ]) print(a)
11th Mar 2020, 9:37 PM
sajjad yazdanparast
sajjad yazdanparast - avatar
0
I dont know about it
10th Mar 2020, 5:45 AM
Vikas Karyani
Vikas Karyani - avatar
0
It will include punctuation if input
10th Mar 2020, 6:02 AM
Vikas Karyani
Vikas Karyani - avatar
0
If input is vikas. Karyani It will include . Also i want to avoid it
10th Mar 2020, 6:09 AM
Vikas Karyani
Vikas Karyani - avatar
0
Can u explain this?
10th Mar 2020, 6:31 AM
Vikas Karyani
Vikas Karyani - avatar
0
What does re work for?
10th Mar 2020, 6:32 AM
Vikas Karyani
Vikas Karyani - avatar