Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
string pick the first 2 characters python 1

string pick the first 2 characters python

June 12, 2022 by Anurag batra
t = "your string"
t[:2]

Here is what the above code is Doing:
1. We create a variable called t and set it equal to the string “your string”.
2. We then use the slice notation to select the first two characters of the string.
3. We print the result.

Categories Python Examples
Post navigation
django set default value for model not form
get index number pandas dataframe
© MyEduKit - 2022 . All Rights Reserved.