I have a .txt file with entries separated by a newline and a comma, alternating.
x = file_1.read().split("\n") ... x = ['10,0902', '13897,00641']
how can I also delimit by a comma? .split("\n" and ",") does not seem to work
.split("\n" and ",")
.split("\n" and ",") is the same as .split(True) which doesn't make much sense.
.split(True)
You'd want to use re.split so you can split by a regex:
import re string = '1,2\n3,4' print(re.split(r'(?:\n|,)', string)) # ['1', '2', '3', '4']