Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

modify a list with for loop and range function in python

cities = ['new york city', 'mountain view', 'chicago', 'los angeles']

for index in range(len(cities)):
    cities[index] = cities[index].title()

print(cities)

# output - ['New York City', 'Mountain View', 'Chicago', 'Los Angeles']
Comment

PREVIOUS NEXT
Code Example
Python :: crawl a folder python 
Python :: pivot pyspark 
Python :: seaborn.distplot() 
Python :: Convert column as array to column as string before saving to csv 
Python :: python string cut first n characters 
Python :: check if queryset is empty django template 
Python :: code to take the picture 
Python :: merge two dictionaries 
Python :: python serial readline 
Python :: python command as an administrator 
Python :: python access key in dictionary 
Python :: counter +1 python 
Python :: a string starts with an uppercase python 
Python :: squre value of a column pandas 
Python :: python join list 
Python :: py -m pip 
Python :: pandas currency to numbe 
Python :: cv2 imwrite 
Python :: try python 
Python :: remove brases from array py 
Python :: fill a column based on values in another column pandas 
Python :: pyqt5 qtextedit change color of a specific line 
Python :: parallel loops in python 
Python :: python abc 
Python :: Python dir() built-in function 
Python :: install os conda 
Python :: create table pyspark sql 
Python :: for pyton 
Python :: closedxml hide column 
Python :: last element of list python 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =