so i have this code:
for line in open('music.txt'):
if 'file : "' in line:
c = line.split('file : "')
del c[0]
d="".join(c)
a=re.sub('"','',d)
e=re.sub(',','',a)
urls.append(e)
Is there a way to do this but without a file?
Maybe you want something like that:
and it works on any file object or list.
For standard input, use
file = sys.stdinExample:
output: