You would do this by creating a dict
:
fruits = {k:[] for k in names}
Then access each by (for eg:) fruits['apple']
– you do not want to go down the road of separate variables!
More Related Contents:
- How t extract last part of a text in python [duplicate]
- How to pass arguments to a Button command in Tkinter?
- Changing one character in a string
- ValueError: setting an array element with a sequence
- Url decode UTF-8 in Python
- How do I get a list of all the duplicate items using pandas in python?
- Using a dictionary to count the items in a list [duplicate]
- Redirecting to URL in Flask
- TypeError: sequence item 0: expected string, int found
- How to get integer values from a string in Python?
- Split a list into parts based on a set of indexes in Python
- How do I use a decimal step value for range()?
- Filtering a Pyspark DataFrame with SQL-like IN clause
- How to return a subset of a list that matches a condition [duplicate]
- How to normalize json correctly by Python Pandas
- Segmenting License Plate Characters
- Replace invalid values with None in Pandas DataFrame
- how to return index of a sorted list? [duplicate]
- Pandas monthly rolling operation
- How can I check the syntax of Python script without executing it?
- Bulk insert with SQLAlchemy ORM
- How to json_normalize a column with NaNs
- What should I use instead of syncdb in Django 1.9?
- Stacked bar chart in Seaborn
- Pivot String column on Pyspark Dataframe
- `if key in dict` vs. `try/except` – which is more readable idiom?
- Adding wheel factorization to an indefinite sieve
- Memory error due to the huge input file size
- Abstract attribute (not property)?
- How do you get the next value in the floating-point sequence? [duplicate]