How to split by comma and strip white spaces in Python?

Use list comprehension — simpler, and just as easy to read as a for loop. my_string = “blah, lots , of , spaces, here ” result = [x.strip() for x in my_string.split(‘,’)] # result is [“blah”, “lots”, “of”, “spaces”, “here”] See: Python docs on List Comprehension A good 2 second explanation of list comprehension.

How to remove trailing and leading whitespace for user-provided input in a batch file?

The solution below works very well for me. Only 4 lines and works with most (all?) characters. Solution: :Trim SetLocal EnableDelayedExpansion set Params=%* for /f “tokens=1*” %%a in (“!Params!”) do EndLocal & set %1=%%b exit /b Test: @echo off call :Test1 & call :Test2 & call :Test3 & exit /b :Trim SetLocal EnableDelayedExpansion set Params=%* … Read more

Scala: XML Whitespace Removal?

scala.xml.Utility.trim() should do what you want: scala> val x = <foo> | <bar>hello world</bar> | <baz> xxx </baz> | </foo> x: scala.xml.Elem = <foo> <bar>hello world</bar> <baz> xxx </baz> </foo> scala> scala.xml.Utility.trim(x) res0: scala.xml.Node = <foo><bar>hello world</bar><baz>xxx</baz></foo>

Is there any way to view whitespace in the query editor for SQL Server Management Studio Express 2005?

In case you still need to know how to do this. Edit the Registry Key in HKEY_CURRENT_USER: Software\Microsoft\Microsoft SQL Server\xx\Tools\Shell\Text Editor\Visible Whitespace Where xx is the version you have (90 is 2005, 100 is 2008) And set it to 1 to show. Or for SQL Server 2012 and up client tools it is also in … Read more