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

Legal Disclaimer

Chip Designing for ASIC/ FPGA Design engineers and Students
FULLCHIPDESIGN
Digital-logic Design...  Dream for many students… start learning front-end…

Legal Disclaimer

@TYH :- 4G LTE Long Term Evolution Tutorial, CloudComputing
PICS
Verilog Tutorial.
Get Noticed:- Submit your own content to be published on fullchipdesign.com

Send it to fullchip@gmail.com

Digital Basics Tutorial.
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.