listA = "AAABBBCCC","DDDEEEFFF"result = map(lambda x: x[:3], listA)print(*result)result = [x[:3] for x in listA]print(result)
Standard input is empty
AAA DDD ['AAA', 'DDD']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!