I have a string in the below format:
00:aa:bb:cc:dd:ee
I need to split it and output only first 3 fields, i.e. 00:aa:bb. I am using
s.split(':')[1:3]
in my program to do the job, but its not helping. Is it the right way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What do you mean it’s not helping? Is it because the result is a list? To turn it back to a string try:
Also note the zero-index.