aboutsummaryrefslogtreecommitdiff
path: root/challenge-028/paulo-custodio/python/ch-1.py
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-12-17 16:48:10 +0000
committerGitHub <noreply@github.com>2021-12-17 16:48:10 +0000
commit0bd5eedae81ce783ed106f26d9567b2cc92ccb45 (patch)
tree00f63f3529aed0d9dc8a3b603f6842ce72599b63 /challenge-028/paulo-custodio/python/ch-1.py
parent6034132cb5eb045dd442499fcbf7fac838d6d0e8 (diff)
parentef3944bc3d9772d7a4b950682a046e0fb185f8d8 (diff)
downloadperlweeklychallenge-club-0bd5eedae81ce783ed106f26d9567b2cc92ccb45.tar.gz
perlweeklychallenge-club-0bd5eedae81ce783ed106f26d9567b2cc92ccb45.tar.bz2
perlweeklychallenge-club-0bd5eedae81ce783ed106f26d9567b2cc92ccb45.zip
Merge pull request #5381 from pauloscustodio/devel
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.py17
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.")