>>> tmp = "a,b,cde" >>> tmp2 = tmp.split(',') >>> tmp2.reverse() >>> "".join(tmp2) 'cdeba'
>>> tmp = "a,b,cde" >>> ''.join(tmp.split(',')[::-1]) 'cdeba'
The important parts here are the split function and the join function. To reverse the list you can use
reverse(), which reverses the list in place or the slicing syntax
[::-1] which returns a new, reversed list.
- Split Strings into words with multiple word boundary delimiters
- Split string with multiple delimiters in Python [duplicate]
- Split string on whitespace in Python [duplicate]
- Split string every nth character?
- Splitting on last delimiter in Python string?
- How do I split a multi-line string into multiple lines?
- Split a string by a delimiter in python
- When splitting an empty string in Python, why does split() return an empty list while split(‘\n’) returns [”]?
- How would I get everything before a : in a string Python
- How can I split and parse a string in Python?
- Get last “column” after .str.split() operation on column in pandas DataFrame
- Split a string only by first space in python
- Why are empty strings returned in split() results?
- Splitting a semicolon-separated string to a dictionary, in Python
- How to split strings into text and number?
- How to split a Python string on new line characters [duplicate]
- How do I reliably split a string in Python, when it may not contain the pattern, or all n elements?
- Splitting a string into words and punctuation
- how to get the last part of a string before a certain character?
- Best way to loop over a python string backwards
- How to split a string of space separated numbers into integers?
- Reading a text file and splitting it into single words in python
- Split text after the second occurrence of character
- Product code looks like abcd2343, how to split by letters and numbers?
- Split string on commas but ignore commas within double-quotes?
- Split string at nth occurrence of a given character
- splitting a string based on tab in the file
- removing newlines from messy strings in pandas dataframe cells?
- How to split a string using an empty separator in Python
- Split a string into 2 in Python
- Python Reverse Find in String
- How can I split by 1 or more occurrences of a delimiter in Python?
- How to replace some characters from the end of a string?
- Reverse string: string[::-1] works, but string[0::-1] and others don’t
- Splitting a string by list of indices
- Reverse a string without using reversed() or [::-1]?
- Reverse a string in Python two characters at a time (Network byte order)
- Does Python have a string ‘contains’ substring method?
- Print string to text file
- Iterating each character in a string using Python
- Good Python modules for fuzzy string comparison? [closed]
- Splitting dataframe into multiple dataframes
- Insert some string into given string at given index
- removing emojis from a string in Python
- How to find char in string and get all the indexes?
- I have a string whose content is a function name, how to refer to the corresponding function in Python?
- Is python += string concatenation bad practice?
- String literal with triple quotes in function definitions
- Mutable strings in Python
- python: dictionary to string, custom format?