Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Updating Strings in Python
You can "update" an existing string by (re)assigning a variable to another string. The new value can be related to its previous value or to a completely different string altogether. For example −
Example
#!/usr/bin/python var1 = 'Hello World!' print "Updated String :- ", var1[:6] + 'Python'
Output
When the above code is executed, it produces the following result −
Updated String :- Hello Python
Advertisements
