How to split this string where
__ is the delimiter
To get an output of
You may be interested in the
csv module, which is designed for comma-separated files but can be easily modified to use a custom delimiter.
import csv csv.register_dialect( "myDialect", delimiter = "__", <other-options> ) lines = [ "MATCHES__STRING" ] for row in csv.reader( lines ): ...