get first 4 characters of a string python 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'