Python Forum

Full Version: Best way to strip() after split()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Python 3.5.2 (default, Jul 17 2016, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> data = 'Red Duck | $125 | New | Ready | Very Good'
>>> product, price, condition, available, rating = data.split(' | ')
>>> print(product)
Red Duck
what error do you get - you can see it works in the interpreter. It also works as stand alone script too. Maybe post the code and full traceback.
the box is from using inline tag - in the editor it is second tag from the right - i.e. you have following tags in the editor: python, error, output, inlune, hint
Never mind! It was a typo in both cases. It is all good now.
Thanks a lot. You have been most helpful
Pages: 1 2