Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my_list = ['a', '=', 'x+y', '//', 'moo']
- if '//' in my_list:
- my_list = my_list[0:my_list.index('//')]
- print my_list
- ['a', '=', 'x+y']
- list_operators = ['+', '-', '/', '*', '(', ')']
- my_list = ['a', '=', 'x+y*z', '//', 'moo']
- ['a', '=', 'x','+','y','*','z', '//', 'moo']
- my_list = my_list[0:mylist.index('//')]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement