diff options
| author | Paulo Custodio <pauloscustodio@gmail.com> | 2021-12-17 11:48:55 +0000 |
|---|---|---|
| committer | Paulo Custodio <pauloscustodio@gmail.com> | 2021-12-17 11:48:55 +0000 |
| commit | 40ecb91eca8db21fb151ad8c148dd3e3b3f877c2 (patch) | |
| tree | 5438e53f9b97a95bf82b99df8e8aacb3b41b36fc /challenge-028/paulo-custodio/python/ch-1.py | |
| parent | 8c1fdda84743187534ae4615a0dfcb41283293e4 (diff) | |
| download | perlweeklychallenge-club-40ecb91eca8db21fb151ad8c148dd3e3b3f877c2.tar.gz perlweeklychallenge-club-40ecb91eca8db21fb151ad8c148dd3e3b3f877c2.tar.bz2 perlweeklychallenge-club-40ecb91eca8db21fb151ad8c148dd3e3b3f877c2.zip | |
Add Perl and Python solutions to challenge 028
Diffstat (limited to 'challenge-028/paulo-custodio/python/ch-1.py')
| -rw-r--r-- | challenge-028/paulo-custodio/python/ch-1.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-028/paulo-custodio/python/ch-1.py b/challenge-028/paulo-custodio/python/ch-1.py new file mode 100644 index 0000000000..2ed8ff5b7b --- /dev/null +++ b/challenge-028/paulo-custodio/python/ch-1.py @@ -0,0 +1,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.") |
