By
python | Published:
30 October 2012
|
import copy
a = [[1],[2],[3]] # Création d'une liste
b = copy.copy(a) # Copier l'objet liste
pri |
|
By
python | Published:
29 October 2012
|
import symbol
print "print", symbol.print_stmt
print "continue", symbol.continue_stmt
print "retur |
|
By
python | Published:
28 October 2012
|
code_script = """
print 'Apprendre à programmer'
"""
# Compiler le script
try
code = compile(c |
|
By
python | Published:
27 October 2012
|
def function(a, b):
print a, b
apply(function, ("France", "Paris"))
apply(function,([8,5]))
ap |
|
By
python | Published:
26 October 2012
|
import _winreg
explorer = _winreg.OpenKey(
_winreg.HKEY_CURRENT_USER,
"SoftwareMicrosoft |
|
By
python | Published:
25 October 2012
|
import linecache
print linecache.getline("test.py", 5)
print linecache.getline("exemple.py", 9) |
|
By
python | Published:
24 October 2012
|
import msvcrt
print "Pour quitter appuyer sur ESC"
while 1:
char = msvcrt.getch()
if char |
|
By
python | Published:
23 October 2012
|
import sys
def exemple(n):
j = 0
for i in range(n):
j = j + i
return n
def pr |
|
By
python | Published:
22 October 2012
|
import gc gc_was_enabled = gc.isenabled( )
if gc_was_enabled:
gc.collect( )
gc.disable( ) |
|
By
python | Published:
21 October 2012
|
import pdb
def test(n):
j = 0
for i in range(n):
j = j + i
return n
db = pdb. |
|