- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get first 100 characters of the string in Python?
The slice ( : ) operator in Python allows you to obtain a part of string. The slice operator has two operands, index of beginning of slice and end of slice.
substr = var[x:y]
In following example, three characters from 7th characters are obtained ( Python sequence uses zero based index)
>>> var="Hello how are you?" >>> str1=var[6:9] >>> str1 'how'
In order to obtain first 100 characters,
- Find the player who rearranges the characters to get a palindrome string first in Python
- How to find the first 10 characters of a string in C#?
- How to generate the first 100 Odd Numbers using C#?
- How to generate the first 100 even Numbers using C#?
- How can I get last 4 characters of a string in Python?
- Check whether second string can be formed from characters of first string in Python
- How to get first day of the week using Python?
- How to get first N characters from a MySQL column?
- How to extract the first n characters from a string using Java?
- How to extract first two characters from a string in R?
- How to get the length of a string in Python?
- How to get the size of a string in Python?