代码搜索结果

找到约 11,834 项符合 Python 的代码

mydown.net.txt

我的源码下载站 www.MyDown.net Admin@MyDown.net ╔------------------------------------------------╗ ┆C/C++ VB Delphi JAVA PYTHON PERL RUBY

print_tuple.py

#!/usr/bin/env python # Filename: print_tuple.py age=22 name='Swaroop' print '%s is %d years old' %(name,age) print 'Why is %s playing with that python?' %name

break.py

#!/usr/bin/env python # Filename: break.py while True: s=raw_input('Enter something : ') if s=='quit': break print 'Length of the string is',len(s) print 'Done'

mymodule_demo.py

#!/usr/bin/env python # Filename: mymodule_demo.py import mymodule mymodule.sayhi() print 'Version', mymodule.version

function1.py

#!/usr/bin/env python # Filename: function1.py def sayHello(): print 'Hello World!' # block belonging to the function sayHello() # call the function

using_name.py

#!/usr/bin/env python # Filename: using_name.py if __name__=='__main__': print 'This program is being run by itself' else: print 'I am being imported from another module'

func_global.py

#!/usr/bin/env python # Filename: func_global.py def func(): global x print 'x is',x x=2 print 'Changed local x to',x x=50 func() print 'Value of x is',x

continue.py

#!/usr/bin/env python # Filename: continue.py while True: s=raw_input('Enter something : ') if s=='quit': break if len(s)

simplestclass.py

#!/usr/bin/env python # Filename: simplestclass.py class Person: pass # An empty block p=Person() print p

method.py

#!/usr/bin/env python # Filename: method.py class Person: def sayHi(self): print 'Hello, how are you?' p=Person() p.sayHi() # This short example can also be written as Person().sayHi()