
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
nHow to print out the first character of each list in Python?
Assuming that the list is collection of strings, the first character of each string is obtained as follows −
>>> L1=['aaa','bbb','ccc'] >>> for string in L1: print (string[0]) a b c
If list is a collection of list objects. First element of each list is obtained as follows −
>>> L1=[[1,2,3],[4,5,6],[7,8,9]] >>> for list in L1: print (list[0]) 1 4 7
- Related Articles
- How to print the first character of each word in a String in Java?
- Java Program to Capitalize the first character of each word in a String
- Golang program to capitalize first character of each word in a string
- Print number of words, vowels and frequency of each character
- How to extract the first row of each matrix stored in a list in R?
- How to remove the first character of string in PHP?
- How to print Unicode character in C++?
- Java Program to Print first letter of each word using regex
- C++ Program to Print first letter of each word using regex
- Golang program to print first letter of each word using regex
- How do make a flat list out of list of lists in Python?
- Print first letter of each word in a string in C#
- How do we find out if first character of a string is a number in java?
- Frequency of each character in String in Python
- How to find the first character of a string in C#?

Advertisements