Home.Verilog.Digital Design.Digital Basics.Python.RF Basics.
Previous.
Next.
Custom Search

Feedback ? Send it to admin@fullchipdesign.com or join me at fullchip@gmail.com

Legal Disclaimer

Chip Designing for ASIC/ FPGA Design engineers and Students
FULLCHIPDESIGN
Digital-logic Design...  Dream for many students… start learning front-end…
Try navigation bar on top to explore the contents @ fullchipdesign

Legal Disclaimer

Custom Search
File read operations.

Class & global var.

File write op's.

Glob module.

Conditional stms.

String 2 hex.

UNIX in Python.

Diamond Pattern.

TypeError - arg.

TyprError - str.

TypeError - strconv.

AttributeError.

Function call.

Read bin files.

Read file using class and global variables.

         import sys

         import os

         import string

 

         class readfile:

 

                def file_read(self, file):

                       self.file_to_read = file

                       self.rfile = self.file_to_read.read()

                       print self.rfile

                       return

 

        if len(sys.argv) == 1:

            r1 = readfile()

            r1.file_read(sys.stdin)

                

        else:

            r1 = readfile()

            r1.file_read(open(sys.argv[1], 'r'))

 

 

 

We can further modify the read by using classes and global variables in python.