Related pages:
import re filename = "file2016.txt" match = re.search(r"[0-9{4}",filename) match.group(0)
re.sub(r"[0-9{4}","2011",filename)
def f(): print "hi" d = {0:f} d[0]()
x = [1,2] y = x z = [x[0],x[1]] print x, y, z y[0] = 3 print x, y, z
[1, 2] [1, 2] [1, 2] [3, 2] [3, 2] [1, 2]
7 \\ 3
, which would give 2”.
import math print math.ceil(7.5) print int(math.ceil(7.5))
print type(2)
personal_random_seed = 1 start = 1 stop = 100 step = 1 random.seed(personal_random_seed) random.randrange(start,end,step)
class Foo: def hello(self): print "Hello World" # without reflection obj = Foo() obj.hello() # with reflection class_name = "Foo" method = "hello" obj = globals()[class_name]() getattr(obj, method)()
global_dict = {} def globals(): return global_dict class Foo: def hello(self): print "Hello World" global_dict['Foo'] = Foo # without reflection obj = Foo() obj.hello() # with reflection class_name = "Foo" method = "hello" obj = globals()[class_name]() getattr(obj, method)()
Error: Inconsistent indentation detected! 1) Your indentation is outright incorrect (easy to fix), OR 2) Your indentation mixes tabs and spaces. To fix case 2, change all tabs to spaces by using Edit->Select All followed by Format->Untabify Region and speicfiy the number of columns used by each tab
Syntax error There's an error in your program: unindent does not match any outer indentation level
Command line: C:\Python27\python.exe C:\Python27\Lib\site-packages\pylint\lint.py C:\Users\Public\projects\SPOTIF~1\REVERS~1.PY -f parseable C:\Users\Public\projects\SPOTIF~1\REVERS~1.py:1: [C] Invalid name "REVERS~1" for type module (should match (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$) Process "Pylint" terminated, ExitCode: 00000010
File "C:\Python27\lib\site-packages\codebreaker_package\pygubu_codebreaker.py", line 33, in <module> import pygubu File "C:\Python27\Scripts\pygubu.py", line 43, in <module> print("Pygubu: v. %s" % (pygubu.__version__,)) AttributeError: 'module' object has no attribute '__version__'