split string s using separator
c = "separator_string"
Front
import string
words = string.split(s, c)
Back
range creates a list, not including the second number
Front
y = range(start, stop[, step])
y = range(20)
Back
some functions and data members of os module
Front
-rename -mkdir
-getcwd
-system (execute an os level command)
Back
list functions in a module
Front
dir(module_name)
ex: dir(__builtins__)
Back
some functions and data members of string module
Front
- atoi/f/l (convert string to integer/floating/long)
-find (find substring)
-split (break into words)
-upper/lower (convert case)
Back
Define a function
Front
def function_name(args)
Back
xrange
Front
is a sequence object that evaluates lazily.
Back
some functions and data members of sys
(Allows interaction with python system)
Front
-exit
-argv
-path (python system path)
-ps1 (command prompt icon)
Back
How to access to the local variables of the function we just called?
Front
global name_of_the_variable
Back
The args of the program
Front
args = sys.argv[1:]
Back
Python is pass by ...
Front
value
Back
argument list is held within the ... module and called ... for ...
Front
sys, argv, argument values
- The list is is sys.argv
Back
To return from a function using its argument
Front
- Make a list argument
- Append the results to it
Back
How to return a list from a function
Front
return (list_name) *Don't forget the ()
Back
What holds the last result in interactive mode? (not assigned a value)
Front
_
Back
some functions and data members of time module
Front
- time (current time: seconds from some date in os)
- gettime(convert time in secs to UTC)
- localtime (convert to local time)
- ex: time.localtime(time.time())
-sleep (pause program for some seconds)
-mktime (opposite of localtime)