Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
Python
Language Basics 122 codes
Home
Python
Language Basics
1 A comment on the same line as code
2 A trailing comma avoids the newline after the output
3 A tuple is an immutable list
4 A value can be assigned to several variables simultaneously
5 Analysis of examination results
6 And Or in Python
7 And or with values in a list
8 Assigning Consecutive Values
9 Assigning Multiple Values at Once
10 Backslashes allow continuations
11 Boolean operation in if
12 Break and continue Statements, and else Clauses on Loops
13 Built-in function unicode() provides access to all registered Unicode codecs
14 Calculating compound interest
15 Calculation in Python
16 Catch and recover exception
17 Catch data type miss match
18 Catch exception throwed inside a function
19 Catch several exceptions
20 Change referenced variable value
21 Class attributes and static methods
22 Comment in Python
23 Convert a Unicode string into an 8-bit string
24 Convert string
25 Creating Unicode strings in Python
26 Define and call static method in a class
27 Define and use a module
28 Define and use Module
29 Define and use Modules
30 Defining Clean-up Actions
31 Demonstrates global variables
32 Demonstrates the break and continue statements
33 Demonstrates the differences between the methods for importing modules
34 Dictionary for loop
35 Divide in Python
36 Divided by int or by float
37 Effects of Setting the Default Encoding
38 Elif demo
39 Fetches an already-loaded module
40 For loop combined with in function
41 For loop demo
42 For with else
43 Forces new code to loadrun
44 Garbage collector is enabled
45 Global variables
46 Guess My Number
47 How to use while
48 If statement
49 If Statements
50 If structure
51 If with else
52 If-elif-else structure
53 If-else structure
54 Import a package
55 Import a pre-defined module
56 Import a specific member from a module
57 Import all members in a module
58 Import enclosing module
59 Import statement that imports names from a module directly
60 Introducing and
61 Introducing globals()
62 Introducing or
63 Leap Year checker
64 Local and global Scoping example
65 Local variable hides global
66 Locale module accesses a database of culture specific data formats
67 Locals() Is Read-Only
68 Logical operators conditions
69 Loop can be applied to any iterable object
70 Mixed String type
71 Module import
72 Module scope variables
73 Nested if demo
74 Nested if statement
75 Nested try and catch
76 Not demo
77 Operator Precedence
78 Packages Are Modules
79 Pprint module offers more sophisticated control over printing
80 Print accepts various data types
81 Print command
82 Print module infomation
83 Product in Python
84 Programmer-created funcitons
85 Raise exception and catch it
86 Read a number and do calculation
87 Read a number and do the divide by 2
88 Read a number and time int value
89 Reference a variable by name
90 Russian encode
91 Same reference to an integer object, a string and a list
92 Small u in front of the quote indicates that an Unicode string
93 Statement
94 Storing Non-ASCII Characters
95 Strings (and numbers and tuples) are immutable
96 The break and continue statements
97 The type Function
98 Truncating division
99 Try with else statement
100 Tryexceptelse
101 Type function used for class
102 Ur to have Python use the Raw-Unicode-Escape encoding
103 Use # to start a comment
104 Use else in exception handle
105 Use global key word to reference outside global variables
106 Use if inside while
107 Use the unicode() function produce a corresponding Unicode string from a specific encoding
108 Using sys modules
109 Using the and-or Trick
110 Using the and-or Trick Safely
111 Using the break statement in a for structure
112 Using the break statement to avoid repeating code in the class-average program
113 Using the continue statement in a forin structure
114 When the and-or Trick Fails
115 While loop
116 While loop demo
117 While loop with counter-controlled repetition
118 While loop with sentinel-controlled repetiton
119 While with break
120 While with else
121 Write an initial sub-sequence of the Fibonacci series
122 ZeroDivisionError Demo