Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to reverse word order in python

## initializing the string
string = "I am a python programmer"
## splitting the string on space
words = string.split()
## reversing the words using reversed() function
words = list(reversed(words))
## joining the words and printing
print(" ".join(words))
Comment

PREVIOUS NEXT
Code Example
Python :: pandas read excel 
Python :: pandas count rows with value 
Python :: datetime date of 10 years ago python 
Python :: time track python 
Python :: python one line return 
Python :: cv2 waitkey 
Python :: python run exe with arguments 
Python :: python tkinter disable dropdown 
Python :: python filter list of int and strings 
Python :: pt_core_news_sm spacy download 
Python :: ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject 
Python :: print zip object python 
Python :: how to factorise expressions in python 
Python :: train test split python 
Python :: create dataframe from csv and name columns pandas 
Python :: wxpython custom dialog 
Python :: native bold text 
Python :: pandas row number by group 
Python :: opposite of .isin pandas 
Python :: change tick labelsize matplotlib 
Python :: write geopands into postgres python 
Python :: how to install cuda in anaconda 
Python :: python round up 
Python :: count the frequency of words in a file 
Python :: messages django 
Python :: dictionary in python does not support append operation 
Python :: discord.py on command error 
Python :: opencv histogram equalization 
Python :: discord.py commands.group 
Python :: plt close all 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =