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

We can also use 

Readlines - as list of strings

Readline - reads only a single line

Read file from command line

Command line arguments lists as string with sys.argv’

import sys

import os

import string

 

def file_read(file):

      rfile = file.read()

      print rfile

                

if len(sys.argv) == 1:

   file_read(sys.stdin)

else:

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

 

 

import sys

import os

import string

 

def file_read(file):

      rfile = file.read()

      print rfile

      file = file_read(open('readme.txt', 'r'))

 

 

Python File Read operations

Open and read file from within the Python program as a single string using 'read'

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.