

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
- Related Questions & Answers
- Updating Lists in Python
- Updating Tuples in Python
- Updating Dictionary in Python
- Updating data in MongoDB
- Buddy Strings in Python
- Updating sub-object in MongoDB?
- Updating boolean value in MySQL?
- Updating nested document in MongoDB
- Updating Nested Embedded Documents in MongoDB?
- React.js Component Lifecycle - Updating phase
- Updating MongoDB collection for _id?
- Python - Filter Supersequence Strings
- How do I create an automatically updating GUI using Tkinter in Python?
- Updating an array with $push in MongoDB
- Updating a record in MySQL using NodeJS
Advertisements