GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python3-files/reverse-file at master · prashanthreddyp/python3-files Expand file tree/ Copy pathreverse-fileMore file actions executable file ·32 lines (22 loc) · 667 Bytes / Copy pathreverse-fileFile metadata and controlsexecutable file ·32 lines (22 loc) · 667 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #!/usr/bin/env python3.7 import argparse import sys parser = argparse.ArgumentParser() parser.add_argument("filename", help="the file to read") parser.add_argument("--limit", "-1", type=int, help="the number of lines to read") parser.add_argument("--version", "-v", action="version", version="%(prog)s 1.0") args = parser.parse_args() try: f = open(args.filename) limit = args.limit except FileNotFoundError as err: print(f"Error: {err}") sys.exit(2) else: with f: lines = f.readlines() lines.reverse() if limit: lines = lines[:limit] for line in lines: print(line.strip()[::-1]) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |