1characters = 4
2string = "This is a string"
3print(string[:characters])
4#output: 'This'
1# Get First 3 character of a string in python
2first_chars = sample_str[0:3]
3print('First 3 characters: ', first_chars)
4
5# Output:
6First 3 characters: Hel