Many file formats have "magic bytes" that you can use for that purpose.
https://en.wikipedia.org/wiki/List_of_file_signatures

Ingo

On 31-5-2019 12:03, Sunil Tech wrote:
> Hi Tutor,
> 
> Is there any way that I can actually programmatically compare the file
> extension with its content?
> 
> This is because we can manually save the file in one extension and later
> rename the file extension to some other.
> 
> Thanks
> - Sunil. G
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to