def Read(): try: with con: cur.execute("SELECT * FROM SPILLER ORDER BY SCORE DESC") # Indholdet hentes rows=cur.fetchall() # resultatet gemmes i variablen rows for row in rows: Console.WriteLine(row) except: Console.WriteLine("Failed to get highscores from database")
def Attack(self): if (self._windup): Console.WriteLine("You swing your {0} and deal {1} damage", self._name, self._damage) self._windup = False return self._damage else: self._windup = True Console.WriteLine("You ready your {0}", self._name) return 0
def CDREventArrived(sender, e): ##Get the Event object and display it pd = e.NewEvent.Properties["TargetInstance"] mbo = pd.Value if (mbo.Properties["VolumeName"].Value is not None): titleRetriever = TitleRetriever(mbo.Properties["DeviceID"].Value[0:1]) movieName = titleRetriever.getMovieName() Console.WriteLine("Found: "+movieName) notifier.showBalloon("Begining Archive",movieName) mkvFile = ripper.rip(titleRetriever.driveLetter, movieName) ripper.transcode(mkvFile, movieName) else: notifier.showBalloon("Disk Ejected") Console.WriteLine("CD has been ejected")
def Attack(self): if self._windup == False: self._windup = True Console.WriteLine("The enemy attacks for {0} damage", self._damage) return self._damage else: print("The enemy is winding up!") self._windup = False return 0
def Block(self, damage): Console.WriteLine( "You defend yourself with your {0}, it blocks {1} damage", self._name, self._block) if (self._block < damage): return damage - self._block else: return 0
def _bp_add(self, keyinfo): try: args = Console.ReadLine().Trim().split(':') if len(args) != 2: raise Exception, "Only pass two arguments" linenum = int(args[1]) for assm in self.active_appdomain.Assemblies: for mod in assm.Modules: bp = create_breakpoint(mod, args[0], linenum) if bp != None: self.breakpoints.append(bp) bp.Activate(True) Console.WriteLine("Breakpoint set") return False raise Exception, "Couldn't find %s:%d" % (args[0], linenum) except Exception, msg: with CC.Red: print "Add breakpoint failed", msg
def _print_source_line(self, sp, lines): linecount = len(lines) linecount_fmt = "%%%dd: " % len(str(linecount)) for i in range(sp.start_line, sp.end_line + 1): with CC.Cyan: Console.Write(linecount_fmt % i) line = lines[i - 1] if i <= linecount else "" start = sp.start_col if i == sp.start_line else 1 end = sp.end_col if i == sp.end_line else len(line) + 1 with CC.Gray: Console.Write(line.Substring(0, start - 1)) with CC.Yellow: Console.Write(line.Substring(start - 1, end - start)) Console.Write(line.Substring(end - 1)) if sp.start_line == sp.end_line == i and sp.start_col == sp.end_col: with CC.Yellow: Console.Write(" ^^^") Console.WriteLine()
print "Enter expressions. Enter blank line to abort input." print "Enter 'exit (the symbol) to exit." print "\n" while True: print prompt, input = Console.ReadLine() if (input == ""): exprstr = "" prompt = ">>> " continue else: exprstr = exprstr + " " + input ## See if we have complete input. try: sympl.parser.ParseExpr(StringReader(exprstr)) except Exception, e: prompt = "... " continue ## We do, so execute. try: res = s.ExecuteExpr(exprstr, feo) exprstr = "" prompt = ">>> " if res is s.MakeSymbol("exit"): break print res except Exception, e: exprstr = "" prompt = ">>> " Console.Write("ERROR: ") Console.WriteLine(e)
cur = con.cursor() cur.execute("Select * from Player") rows = cur.fetchall() print "" i = 0 #Number of rows for row in rows: print "Save ID", row[0] print "Save Name", row[1] print "Save Money", row[2] print "" i += 1 while True: Console.WriteLine("Select a save file (Write the ID number)") playerinput = Console.ReadLine() try: if int(playerinput) < i + 1 and int(playerinput) > 0: break else: print "Please enter something valid" except ValueError: print "Please enter something valid" with con: cur.execute("Select * from Player where Id = " + playerinput) playersave = cur.fetchall() for row in playersave: playerId = row[0] playerName = row[1]
import sqlite3 as lite import sys from System import Console con = None Console.WriteLine("Saving...") def Update(id, money): try: con = lite.connect('Users.db') cur = con.cursor() with con: cur.execute("UPDATE Player SET Money = " + money + " WHERE Id = " + id) except lite.Error, e: print "Error %s:" % e.args[0] sys.exit(1) finally: if con: con.close()
import FrEee import FrEee.Utility from FrEee.Game.Objects.Commands import * clr.ImportExtensions(FrEee.Utility.Extensions) from System import Console # alias the domain and context variables to avoid confusion empire = domain galaxy = context # TODO - Design Managment ministers # TODO - Colony Management ministers if (enabledMinisters.ContainsKey("Empire Management")): category = enabledMinisters["Empire Management"] if (category.Contains("Research")): # choose what to research # TODO - actually choose sensibly, don't always research Propulsion cmd = ResearchCommand() cmd.Spending[Mod.Current.Technologies.FindByName("Propulsion")] = 100 empire.ResearchCommand = cmd # TODO - check for more ministers and execute their code # TODO - Vehicle Managment ministers # test AI data storage if (not empire.AINotes.HasProperty("Log")): empire.AINotes.Log = [] empire.AINotes.Log.Add("{0} has played its turn for stardate {1}.\n".format( empire.Name, galaxy.Stardate)) for msg in empire.AINotes.Log: Console.WriteLine(msg)
# -*- coding: utf-8 -*- # clrをインポートして、System.Windows.Forms.dllを参照に追加 import clr clr.AddReferenceByPartialName("System.Windows.Forms") # System.Windows.Forms名前空間からMessageBoxクラスをインポートして # そのMessageBoxクラスを使ってメッセージ・ボックスを表示 from System.Windows.Forms import MessageBox MessageBox.Show("Hello IronPython!", "Insider.NET") from System import Console Console.WriteLine(u"あいうえお(Console版)") ''' How to run 1. Download IronPython-2.7.7-win.zip 1. Extract zip 1. Set full path of extracted(installed) folder into PATH environment variable. 1. Type following command in terminal. ipy hello_ironpython.py '''
def Ability(self): Console.WriteLine("Your {0} heals you and you gain gain {1} health", self._name, self._heal) return self._heal
def testFail(self): Console.WriteLine("--testFail--") Assert.IsTrue(False, "this will fail")
import clr from System import Console Console.WriteLine("Hello My World!")
def Add(name,score,time): try: with con: cur.execute("INSERT INTO SPILLER (Id,name,score,time) VALUES(NULL,?,?,?)",(name,score,time)) except: Console.WriteLine("Failed to add player to the highscore database")
def Attack(self): Console.WriteLine("You swing your {0} and deal {1} damage", self._name, self._damage) return self._damage
""" >>> import clr ..> clr.AddReference("System.Windows.Forms") ..> from System.Windows.Forms import MessageBox ..> MessageBox.Show("Hello World") ..> END import clr clr.AddReference("System") from System import Console, ConsoleColor Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Red."); Console.WriteLine("Another line."); # <-- This line is still white on blue. Console.ResetColor(); """ try: sys.platform="win32" os.environ['TERM'] = 'dumb' from prompt_toolkit import prompt except Exception as e: traceback.print_exc(file=sys.stdout) """
sqlDbConnection = SqlClient.SqlConnection(sqlConnectionString) sqlDbConnection.Open() workTable = DataTable() workTable.Columns.Add("Col1", Byte) workTable.Columns.Add("Col2",Byte) workTable.Columns.Add("Col3", Int32) workTable.Columns.Add("Col4", Byte) workTable.Columns.Add("Col5", Byte) workTable.Columns.Add("Col6", Single) sampleArray = [Byte(7), Byte(8), Int32(1), Byte(15), Byte(12), Single(0.34324)] for i in range (0, 189000) : workTable.Rows.Add(Array[object](sampleArray)) cmd = SqlClient.SqlCommand("truncate table dbo.MyTable", sqlDbConnection); def bulkLoadEsgData (): sbc = SqlClient.SqlBulkCopy(sqlConnectionString, SqlClient.SqlBulkCopyOptions.TableLock, BulkCopyTimeout=0, DestinationTableName="dbo.MyTable") sbc.WriteToServer(workTable) # Start simulation Console.WriteLine("Enter number of simulations (1 simulation = 189,000 data rows):"+"\n") strN = Console.ReadLine() n = int(strN) cmd.ExecuteNonQuery() for i in range (0, n): bulkLoadEsgData() sqlDbConnection.Close() Environment.Exit(1111)
def Attack(self): Console.WriteLine("The enemy attacks for {0} damage", self._damage) return self._damage
def raw_input(message): Console.WriteLine(message) return Console.ReadLine()
def testPass(self): Console.WriteLine("--testPass--") Assert.IsTrue(True)
import clr from System import Console Console.Write("Digite o seu nome: ") v_nome = Console.ReadLine() Console.WriteLine("Ola, " + v_nome + ".")
def testInBase(self): Console.WriteLine("--testInBase--") Assert.IsTrue(True)
""" Provides an interface between the F# implementation of SAT and Python. If this script is run directly it will make some test calls into F# and print the results. """ import sys from os import path import clr project_dir = path.dirname(path.abspath(__file__)) library_dir = path.join(project_dir, "FSharpImplementation", "bin", "Debug") sys.path.append(library_dir) clr.AddReference("FSharpImplementation") from FSharpImplementationNamespace import SeparatingAxisTheorem has_collided = SeparatingAxisTheorem.hasCollied if __name__ == "__main__": from System import Console Console.WriteLine("Hello from .net") print() print(SeparatingAxisTheorem.mathTest(9, 2)) print() print(SeparatingAxisTheorem.typeTest(((9, 2), (54, 4)))) print()