learn with examples
Suggested approach is to learn examples in the given sequence. Also discussed are few fundamentals.
Few fundamentals to know before we code in Python:
- Import system modules like sys, os, string, time etc. before you start writing code. Importing ‘sys’ and ‘os’ covers majority of the Python core constructs.
- Indenting or tab is most important in Python and should be strictly maintained.
- Reserved word ‘def’ is used for defining a function in Python.
- Reserved word ‘class’ is used to group functions.
- Command line arguments lists as string with ‘sys.argv’.
Following list of
programs are discussed in this sec:
¶ File Operations:
- Open and read file from within the python program as a single string. Command line arguments lists as string with ‘sys.argv’.
- Use of glob module in Python code . Read file using classes, global variables and functions. Program to open and write file.
- Specify files to be written from the command line. File writes using classes and global variables
¶ Program to read file, filter text, conversion to HEX, conversion from Hexadecimal to
Signed Magnitude. Steps for conditional statements, converting string to
hexadecimal value, strip of white space at end, converting 12 bit hexadecimal values to 12 bit signed values.
¶ Advanced python code to cover UNIX shell commands, read lines from a text file, ‘sysargv’ command line operations, use of class and multiple functions.
¶ Write a program to generate diamond pattern.
¶ Python read binary files, use of
¶ Python error’s with complete code examples:-
Hope you liked! this page. Don't forgot to access relevant
previous and next sections with links below.