blob: 2ed8ff5b7b615930d992cb9ffb92e78576cefb5f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
#!/usr/bin/perl
# Challenge 028
# Task #1
# Write a script to check the file content without explicitly reading the
# content. It should accept file name with path as command line argument and
# print "The file content is binary." or else "The file content is ascii."
# accordingly.
import sys
file = sys.argv[1]
if b'\x00' in open(file, 'rb').read():
print("The file content is binary.")
else:
print("The file content is ascii.")
|