SHARE
TWEET

Untitled

a guest Jul 21st, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (cond1 == 'val1' and cond2 == 'val2' and
  2.       cond3 == 'val3' and cond4 == 'val4'):
  3.       do_something
  4.    
  5. if (    cond1 == 'val1' and cond2 == 'val2' and
  6.           cond3 == 'val3' and cond4 == 'val4'):
  7.       do_something
  8.    
  9. if (cond1 == 'val1' and cond2 == 'val2' and
  10.        cond3 == 'val3' and cond4 == 'val4'):
  11.     do_something
  12.    
  13. if (  
  14.        cond1 == 'val1' and cond2 == 'val2' and
  15.        cond3 == 'val3' and cond4 == 'val4'
  16.    ):
  17.     do_something
  18. if    (cond1 == 'val1' and cond2 == 'val2' and
  19.        cond3 == 'val3' and cond4 == 'val4'):
  20.     do_something
  21.    
  22. if cond1 == 'val1' and cond2 == 'val2' and
  23.    cond3 == 'val3' and cond4 == 'val4':
  24.     do_something
  25.    
  26. if cond1 == 'val1' and cond2 == 'val2' and
  27.                        cond3 == 'val3' and
  28.                        cond4 == 'val4':
  29.     do_something
  30.    
  31. if cond1 == 'val1' and
  32.    cond2 == 'val2' and
  33.    cond3 == 'val3' and
  34.    cond4 == 'val4':
  35.     do_something
  36.    
  37. if all( [cond1 == 'val1', cond2 == 'val2', cond3 == 'val3', cond4 == 'val4'] ):
  38.  
  39. if any( [cond1 == 'val1', cond2 == 'val2', cond3 == 'val3', cond4 == 'val4'] ):
  40.    
  41. if (     cond1 == val1
  42.      and cond2 == val2
  43.      and cond3 == val3
  44.    ):
  45.     do_stuff()
  46.    
  47. if (    cond1 == val1
  48.      or
  49.         (     cond2_1 == val2_1
  50.           and cond2_2 >= val2_2
  51.           and cond2_3 != bad2_3
  52.         )
  53.    ):
  54.     do_more_stuff()
  55.    
  56. def is_action__required(...):
  57.     return (cond1 == 'val1' and cond2 == 'val2'
  58.             and cond3 == 'val3' and cond4 == 'val4')
  59.    
  60. if (cond1 == 'val1' and cond2 == 'val2'
  61.   and cond3 == 'val3' and cond4 == 'val4'):
  62.     do_something
  63.    
  64. allCondsAreOK = (cond1 == 'val1' and cond2 == 'val2' and
  65.                  cond3 == 'val3' and cond4 == 'val4')
  66.  
  67. if allCondsAreOK:
  68.    do_something
  69.    
  70. if (
  71.   expr1
  72.   and (expr2 or expr3)
  73.   and hasattr(thingy1, '__eq__')
  74.   or status=="HappyTimes"
  75. ):
  76.   do_stuff()
  77. else:
  78.   do_other_stuff()
  79.    
  80. if (cond1 == 'val1' and cond2 == 'val2'
  81.     and cond3 == 'val3' and cond4 == 'val4'):
  82.     do_something
  83.    
  84. condition = [cond1 == 'val1', cond2 == 'val2', cond3 == 'val3', cond4 == 'val4']
  85.  
  86. if all(condition):
  87.    do_something
  88.    
  89. # No extra indentation.
  90. if (this_is_one_thing and
  91.     that_is_another_thing):
  92.     do_something()
  93.  
  94. # Add a comment, which will provide some distinction in editors
  95. # supporting syntax highlighting.
  96. if (this_is_one_thing and
  97.     that_is_another_thing):
  98.     # Since both conditions are true, we can frobnicate.
  99.     do_something()
  100.  
  101. # Add some extra indentation on the conditional continuation line.
  102. if (this_is_one_thing
  103.         and that_is_another_thing):
  104.     do_something()
  105.    
  106. conditions_met = (
  107.     cond1 == 'val1'
  108.     and cond2 == 'val2'
  109.     and cond3 == 'val3'
  110.     and cond4 == 'val4'
  111.     )
  112. if conditions_met:
  113.     do_something
  114.    
  115. if (
  116.     cond1 and
  117.     cond2
  118. ):
  119.     print("Hello World!")
  120.    
  121. if all([
  122.     cond1,
  123.     cond2,
  124. ]):
  125.     print("Hello World!")
  126.    
  127. # Check if every string in a list contains a substring:
  128. my_list = [
  129.     'a substring is like a string',
  130.     'another substring'
  131. ]
  132.  
  133. if all('substring' in item for item in my_list):
  134.    print("Hello World!")
  135.  
  136. # or
  137.  
  138. if all(
  139.     'substring' in item
  140.     for item in my_list
  141. ):
  142.     print("Hello World!")
  143.    
  144. def c1():
  145.     print " Executed c1"
  146.     return False
  147. def c2():
  148.     print " Executed c2"
  149.     return False
  150.  
  151.  
  152. print "simple and (aborts early!)"
  153. if c1() and c2():
  154.     pass
  155.  
  156. print
  157.  
  158. print "all (executes all :( )"
  159. if all((c1(),c2())):
  160.     pass
  161.  
  162. print
  163.    
  164. if (cond1 == 'val1' and cond2 == 'val2' and
  165.     cond3 == 'val3' and cond4 == 'val4'):
  166.  
  167.     do_something
  168.    
  169. if (cond1 == "val1" and cond22 == "val2"
  170. and cond333 == "val3" and cond4444 == "val4"):
  171.     do_something
  172.    
  173. if (cond1 == "val1" and cond22 == "val2"
  174. and cond333 == "val3" and cond4444 == "val4") {
  175.     do_something
  176. }
  177.    
  178. if not user.isAdmin() and user.isTeacher() and not user.isStudent():
  179.     doSomething()
  180.    
  181. displayTeacherPanel = not user.isAdmin() and user.isTeacher() and not user.isStudent()
  182. if displayTeacherPanel:
  183.     showTeacherPanel()
  184.    
  185. if displayTeacherPanel or user.canSeeSpecialPanel():
  186.     showSpecialPanel()
  187.    
  188. >>> x = {'cond1' : 'val1', 'cond2' : 'val2'}
  189. >>> y = {'cond1' : 'val1', 'cond2' : 'val2'}
  190. >>> x == y
  191. True
  192.    
  193. class Klass(object):
  194.     def __init__(self, some_vars):
  195.         #initialize conditions here
  196.     def __nonzero__(self):
  197.         return (self.cond1 == 'val1' and self.cond2 == 'val2' and
  198.                 self.cond3 == 'val3' and self.cond4 == 'val4')
  199.  
  200. foo = Klass()
  201. if foo:
  202.     print "foo is true!"
  203. else:
  204.     print "foo is false!"
  205.    
  206. class Klass(object):
  207.     def __init__(self):
  208.         #initialize conditions here
  209.     def __eq__(self):
  210.         return (self.cond1 == 'val1' and self.cond2 == 'val2' and
  211.                self.cond3 == 'val3' and self.cond4 == 'val4')
  212.  
  213. x = Klass(some_values)
  214. y = Klass(some_other_values)
  215. if x == y:
  216.     print 'x == y'
  217. else:
  218.     print 'x!=y'
  219.    
  220. if (cond1 == 'val1' and cond2 == 'val2' and
  221.     cond3 == 'val3' and cond4 == 'val4'
  222.    ):
  223.     do_something
  224.    
  225. if bool(condition1 and
  226.         condition2 and
  227.         ...
  228.         conditionN):
  229.     foo()
  230.     bar()
  231.    
  232. if (((foo and
  233.       bar and
  234.       frob and
  235.       ninja_bear))):
  236.     do_stuff()
  237.    
  238. if False not in Conditions:
  239.     do_something
  240.    
  241. if (cond1 == 'val1' and cond2 == 'val2' and
  242.     cond3 == 'val3' and cond4 == 'val4'):
  243.         do_something
  244.    
  245. if cond1 == 'val1' and
  246.      cond2 == 'val2' and
  247.      cond3 == 'val3' and
  248.      cond4 == 'val4':
  249.       do_something
  250.    
  251. if cond1 == 'val1'
  252.      and cond2 == 'val2'
  253.      and cond3 == 'val3'
  254.      and cond4 == 'val4':
  255.       do_something
  256.    
  257. cond_list = ['cond1 == "val1"','cond2=="val2"','cond3=="val3"','cond4=="val4"']
  258. if all([eval(i) for i in cond_list]):
  259.  do something
  260.    
  261. cond_list.append('cond5=="val5"')
  262.    
  263. #!/usr/bin/python
  264. import sys
  265. numberOfArgument =len(sys.argv)
  266. weblogic_username =''
  267. weblogic_password = ''
  268. weblogic_admin_server_host =''
  269. weblogic_admin_server_port =''
  270.  
  271.  
  272. if numberOfArgument == 5:
  273.         weblogic_username = sys.argv[1]
  274.         weblogic_password = sys.argv[2]
  275.         weblogic_admin_server_host =sys.argv[3]
  276.         weblogic_admin_server_port=sys.argv[4]
  277. elif numberOfArgument <5:
  278.         print " weblogic UserName, weblogic Password and weblogic host details are Mandatory like, defalutUser, passwordForDefaultUser, t3s://server.domainname:7001 ."
  279.         weblogic_username = raw_input("Enter Weblogic user Name")
  280.         weblogic_password = raw_input('Enter Weblogic user Password')
  281.         weblogic_admin_server_host = raw_input('Enter Weblogic admin host ')
  282.         weblogic_admin_server_port = raw_input('Enter Weblogic admin port')
  283. #enfelif
  284. #endIf
  285.    
  286. total = cond1 == 'val' and cond2 == 'val2' and cond3 == 'val3' and cond4 == val4
  287. if total:
  288.     do_something()
  289.    
  290. if foo is not None:
  291.     if (cond1 == 'val1' and cond2 == 'val2' and
  292.         cond3 == 'val3' and cond4 == 'val4'):
  293.             # some comment about do_something
  294.             do_something
  295.    
  296. condition = random.randint(0, 100) # to demonstrate
  297. anti_conditions = [42, 67, 12]
  298. if condition not in anti_conditions:
  299.     pass
  300.    
  301. conditions = [1, 2, 3, 4]
  302. values = [1, 2, 3, 4]
  303. if all([c==v for c, v in zip(conditions, values)]):
  304.     # do something
  305.    
  306. if (condition1==value1) and (condition2==value2) and
  307.    (condition3==value3) and (condition4==value4):
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top