Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #In my list I have items stored in the format [ID, TITLE, NAME, DATE] and each column is separated using a ','. I use:
- for item in my_list:
- each_item_in_book = item.split(",")
- item_id = each_item_in_book[0]
- item_title = each_item_in_book[1]
- item_name = each_item_in_book[2]
- item_date = each_item_in_book[3]
- #Sometimes my item will only have [ID, TITLE, NAME] (excludes date) and sometimes [ID, TITLE] (excludes name and date). When it's #like this, the code:
- item_name = each_item_in_book[2]
- item_date = each_item_in_book[3]
- #those two items wont be valid as they don't exist in the list. Is there a way to detect if those are empty?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement