python get first 5 characters of string code example
Example 1: string pick the first 2 characters python
t = "your string"
t[:2]
Example 2: python get first character of string
string = 'This is a string'
print(string[0])
#output: 'T'
t = "your string"
t[:2]
string = 'This is a string'
print(string[0])
#output: 'T'