Linked Questions

-2 votes
1 answer
191 views

How to split punctuation from words in python? [duplicate]

I am attempting to create a spell checking function that reads in a text file containing a passage that contains several misspelt words. For example: "My favorite subjects are: Physcs, Maths, ...
m.lewis1995's user avatar
-2 votes
1 answer
56 views

How can i use python's .split with 2 delimiters

While trying to solve some python exercices I found myself needing to split a string using the .split with 2 delimiters but i cant make it work. I've searched in other people's questions but the ...
Claudio Albino's user avatar
-2 votes
1 answer
61 views

splitting a string Python [duplicate]

Is there any other way to do this: >>> in_string = "Hello, world! how are you? Your oceans are pretty. Incomplete sentence" >>> def sep_words(string_1): """Function which takes a ...
xyz's user avatar
  • 1
-3 votes
1 answer
982 views

print the reverse of algebraic expression

I am writing a python function that prints the reverse of a given function. My solution should be for example if the given expression is 200+500-600 my output should be 600-500+200. My code however is ...
Jennifer 's user avatar
-3 votes
1 answer
216 views

Using Python to split long string, by given ‘separators’ [duplicate]

Environment: Win 7; Python 2.76 I want to split a long string into pieces, according to given separator The string looks like: “C-603WallWizard45256CCCylinders:2HorizontalOpposedBore:1-1/...
Mark K's user avatar
  • 9,094
-3 votes
1 answer
195 views

Which is the easiest way to split strings with two delimiters? [duplicate]

I got an example string: "Santonio-Spurs: a great basketball team" What is the easiest way to split it by space and 'symbol :' Should I split it by space first and then split it by symbol : ? The ...
Zen's user avatar
  • 4,561
-4 votes
1 answer
47 views

Is there a reason that .str.split() will not work with '$_'? [duplicate]

I am trying to split a string using .str.split('$_') but this is not working. Other combinations like 'W_' or '$' work fine but not '$'. I also tried .str.replace('$') - which also does not work. ...
Frank's user avatar
  • 1
1 vote
0 answers
34 views

Partition a string with more than 1 separator [duplicate]

I'd like to partition a string with more than one separator, for example: string = 'xxx-yyy/zzz' I'd like my output to be something like this: ('xxx', '-', 'yyy', '/', 'zzz') Now, I know the ...
CyberLX's user avatar
  • 245
0 votes
0 answers
58 views

How to split once at arithmetic operators starting from the right? [duplicate]

I have the string x = "123+456-789" and I want to have the "123+456-" and "789" in separate variables. How can I store the last few characters of a string excluding the ...
Canofeggs 5410's user avatar
0 votes
0 answers
99 views

Remove 1st and last character from file content in list imput

I'm trying to get the start and end quotes from items "1st name and 8th name" removed from following outputs: A random Draw: 3rd name 7th name 5th name "1st name An other random Draw: ...
Lod's user avatar
  • 715
0 votes
0 answers
58 views

Python .split(), Can you split in multiple ways in the same string? [duplicate]

If i have a text file such as: "1,2,3,4,5 1 2 3 4 5 1 2 3 4 5" How do i account for all of these different ways my numbers are separated if I am appending them to the same list?
Anther Eros's user avatar
0 votes
0 answers
48 views

Made a simple chatbot. How to differentiate "hi" as greetings from words including "...hi..."? [duplicate]

I have created a simple chatbot and so far it is working good. The problem is, if I type for example "hibernate", the script will recognize this as a greetings. I am German and we have a lot ...
user avatar
0 votes
0 answers
43 views

How can we write something like Python's `str.split` which accepts an arbitrary regex as input?

Python's str.split() method usually accepts a string as input. For example, inpoot = "fuzzy#wuzzy#was#a#bear" outpoot = inpoot.split("#") print(outpoot) # ["fuzzy", "...
Toothpick Anemone's user avatar
0 votes
0 answers
55 views

Using split on multiple strings with different delimiters [duplicate]

Say I have to split multiple strings within a for loop, which is separated with different delimiters. For example, here in the following example, I have . and - as delimiters. I wanna split the ...
ARJ's user avatar
  • 2,063
0 votes
0 answers
40 views

How to split a string (containing no spaces) with multiple delimiters in Python? [duplicate]

I have a string looking like this: obj = "<dnvirnfgvireg>hellothere<akdnefbuebuf>" and I want to split it, getting only "hellothere". The "hellothere" is not the same every time and due ...
user avatar

15 30 50 per page
1
2 3 4 5
9