- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Rajendra Dharmkar has Published 452 Articles
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
1K+ Views
In Python, a string is a sequence of Unicode characters, while a byte string is a sequence of raw bytes. Here are three examples that demonstrate the difference between a string and a byte string: Creating a String Example In this example, we define a string "Lorem Ipsum" using double ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
2K+ Views
In Python, both modules and packages are used to organize and structure code, but they serve slightly different purposes. A Python module is a single file containing Python code that can be imported and used in other Python code. A module can define variables, functions, classes, and other Python constructs ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
635 Views
One efficient way to repeat a string to a certain length in Python is to use the string multiplication operator (*) and string concatenation. Here are some code examples with step−by−step explanations: Using string multiplication operator Example Define the original string and the desired length to repeat it to. Calculate ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
1K+ Views
A Python bytestring is a sequence of bytes. In Python 3, bytestrings are represented using the "bytes" data type. Bytestrings are used to represent binary data that doesn't fit into the Unicode character set, such as images, audio, and video files. Here are some code examples that demonstrate working with ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
7K+ Views
In Python, you can use the import statement to use functions or variables defined in another module. Here are some code examples that demonstrate how to use multiple modules with Python import statement: Suppose you have two modules module1.py and module2.py that contain some functions: Example #module1.py def say_hello(name): ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
1K+ Views
To translate a Python string according to a given dictionary, you can use the translate() method in combination with str.maketrans() function. The str.maketrans() function creates a translation table from a given dictionary that maps each character in the dictionary to its corresponding translation. Here are some examples: Translate a string ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
902 Views
Stripping down all the punctuation from a string in Python can be achieved using various methods. Here are some examples: Using string.punctuation Example The string.punctuation constant contains all the ASCII punctuation characters. We can use this constant to remove all the punctuation characters from the string. We are using a ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
1K+ Views
Here, we are considering some code examples to remove specific characters from a string in Python: Using str.replace() In this method, we will use the str.replace() method to replace the specific characters with an empty string. Example We define a string called my_string that contains the original string we want ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
2K+ Views
In Python, escape sequences are special characters that are used to represent certain characters that cannot be easily typed or printed. They are typically represented with a backslash (\) followed by a character that represents the special sequence. For example, the newline character () is used to represent a line ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
578 Views
In Python, you cannot pass arguments by reference like you can in other programming languages like C++. However, there is a way to simulate pass by reference behavior in Python using mutable data types like lists and dictionaries. In Python, arguments are passed by assignment, which means that the ... Read More