Skip to main content
restore original code
Source Link
cottontail
  • 25.6k
  • 25
  • 184
  • 176

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", "MATCHES __ STRING" ] for row in csv.reader( lines ): ... 

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 ): ... 

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", "MATCHES __ STRING" ] for row in csv.reader( lines ): ... 
updated answer to match the edited question
Source Link
Aran-Fey
  • 44k
  • 13
  • 113
  • 161

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 = "$$TEXT""__", <other-options> ) lines = [ "1.MATCHES$$TEXT$$STRING", "2.MATCHES $$TEXT$$ STRING""MATCHES__STRING" ] for row in csv.reader( lines ): ... 

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 = "$$TEXT", <other-options> ) lines = [ "1.MATCHES$$TEXT$$STRING", "2.MATCHES $$TEXT$$ STRING" ] for row in csv.reader( lines ): ... 

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 ): ... 
Source Link
Katriel
  • 124.3k
  • 19
  • 141
  • 172

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 = "$$TEXT", <other-options> ) lines = [ "1.MATCHES$$TEXT$$STRING", "2.MATCHES $$TEXT$$ STRING" ] for row in csv.reader( lines ): ...