Question

I have a m4a file, and i want to open it...what should i do? i've tried the obvious

>>> q = open('file.m4a').read()
>>> len(q)
6989886
>>> print q[:10000]

>>>

It prints a blank line! i've tried to open the file with 'rb' flag but it doesn't work.

Was it helpful?

Solution

Try printing the repr() of the data:

>>> print repr(q[:10000])

If you print the data itself, it may contain control character or other unprintable text, which makes for misleading output. The Python repr() function makes that data readable by escaping the characters as needed.

In the interactive shell, the repr() value of the expression entered is printed if it isn't None. So this would do the same thing:

>>> q[:10000]

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top