You almost had it right. The simplest way is
mylist[0][0] # get the first character from the first item in the list
but
mylist[0][:1] # get up to the first character in the first item in the list
would also work.
You want to end after the first character (character zero), not start after the first character (character zero), which is what the code in your question means.
Related Posts:
- How to convert list to string [duplicate]
- Why is it string.join(list) instead of list.join(string)?
- Why is it string.join(list) instead of list.join(string)?
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- How to check if a string is a substring of items in a list of strings?
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- AttributeError: ‘list’ object has no attribute ‘replace’ when trying to remove character
- How do I check if there are duplicates in a flat list?
- How to concatenate items in a list to a single string?
- Create nice column output in python
- How does str(list) work?
- What is the difference between a string and a byte string?
- Python cant convert ‘list’ object to str error [closed]
- How do I lowercase a string in Python?
- How can I reverse a list in Python?
- Difference between del, remove, and pop on lists
- How can I reverse a list in Python?
- What is the difference between Python’s list methods append and extend?
- Python – TypeError: ‘int’ object is not iterable
- Understanding slice notation
- Understanding slice notation
- TypeError: list indices must be integers or slices, not str
- How do I get a substring of a string in Python?
- Does Python have a string ‘contains’ substring method?
- IndexError: list index out of range and python
- How to read a file line-by-line into a list?
- strip(char) on a string
- Python – TypeError: ‘int’ object is not iterable
- TypeError: a bytes-like object is required, not ‘str’ when writing to a file in Python3
- How do I get the number of elements in a list?
- Finding the index of an item in a list
- Finding the index of an item in a list
- Accessing the index in ‘for’ loops?
- How to make a flat list out of a list of lists
- Print string to text file
- Removing duplicates in lists
- Best way to convert string to bytes in Python 3?
- Pythonic way to create a long multi-line string
- Best way to convert string to bytes in Python 3?
- Does Python have a string ‘contains’ substring method?
- What does the list() function do in Python?
- TypeError: not all arguments converted during string formatting python
- List changes unexpectedly after assignment. Why is this and how can I prevent it?
- Why does this iterative list-growing code give IndexError: list assignment index out of range?
- TypeError: ‘float’ object is not subscriptable
- Is there a short contains function for lists?
- ‘str’ object does not support item assignment
- How do I append one string to another in Python?
- TypeError: ‘float’ object is not subscriptable
- Transpose/Unzip Function (inverse of zip)?
- How do I append one string to another in Python?
- appending list but error ‘NoneType’ object has no attribute ‘append’
- Random string generation with upper case letters and digits
- How can I split and parse a string in Python?
- Check if something is (not) in a list in Python
- Python: finding an element in a list [duplicate]
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- How to read a text file into a string variable and strip newlines?
- Convert bytes to a string
- How to print like printf in Python3?
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- How to read a text file into a string variable and strip newlines?
- Finding the average of a list
- Writing a list to a file with Python
- How do I concatenate two lists in Python?
- if else in a list comprehension
- How can I randomly select an item from a list?
- Print a list in reverse order with range()?
- Get unique values from a list in python [duplicate]
- Fastest way to check if a value exists in a list
- Python convert tuple to string
- write() versus writelines() and concatenated strings
- How can I count the occurrences of a list item?
- TypeError: ‘list’ object cannot be interpreted as an integer
- Split a string into 2 in Python
- How do I concatenate two lists in Python?
- if else in a list comprehension
- Finding median of list in Python
- Python set to list
- Python List vs. Array – when to use?
- Best way to strip punctuation from a string
- Split string with multiple delimiters in Python [duplicate]
- How to find all occurrences of an element in a list
- Get list from pandas dataframe column or row?
- Finding and replacing elements in a list
- How to find all the indexes of a recurring item in a list?
- How to check if the string is empty?
- How to find all occurrences of a substring?
- ValueError: max() arg is an empty sequence
- Remove list from list in Python
- python – if not in list
- How do I concatenate two lists in Python?
- How do I convert a list of ascii values to a string in python?
- How to check whether a str(variable) is empty or not?
- How can I compare two lists in python and return matches
- Replace values in list using Python
- Python TypeError: not enough arguments for format string
- What does the ‘b’ character do in front of a string literal?
- Append integer to beginning of list in Python
- List comprehension on a nested list?