Manage PlItems

You may optionally enter a comparison operator (<, <=, >, >=, <> or =) at the beginning of each of your search values to specify how the comparison should be done.

Advanced Search
Displaying 101-110 of 300 results.
IDPlCodelangPlGroupPlItemTitleCode 
 
166PythonFilehandlingDatei auf dem Betriebssystem ausführenimport commands output=commands.getoutput("dir") print output # home tmp myFile.shView Update Delete
170PythonDatum, ZeitGestriges Datumfrom datetime import date, timedelta d=date.today()-timedelta(days=1) output=d.isoformat() # 2014-02-27 View Update Delete
186PythonStringsString nach Delimenter zerlegenmyString = "A;B;C;D;E" myPieces = myString.split(";") # erzeugt ein Arrey mit den einzelnen Zeichen print myPieces[2] # gibt C ausView Update Delete
188PythonProzeduren, Funktionen, MethodenDeklaration einer Funktion/Prozedurdef this_is_my_function_name(param1): print "do something inside the function " + param1 print "do something outside the function" # call the function this_is_my_function_name("hello world") View Update Delete
189PythonSchleifenFor-Schleifefor i in range(0, 10): i=1 time.sleep(1) print i items = ['computer', 'fruits', 'fraggels'] # without indexes for item in items: print item # with indexes for (i, item) in enumerate(items): print i, itemView Update Delete
190PythonSchleifenWhile Schleifei=10 while i<10: i=i+1 print i View Update Delete
191PythonEncoding / Decodingmd5-Hash erzeugen# https://docs.python.org/2/library/hashlib.html import hashlib a = "hello world" b = 0.1 md5str = hashlib.md5(str(b) + a).hexdigest() View Update Delete
192PythonFilehandlingPrüfen ob Datei existiertimport os filePath="/home/myUser/test.txt" if (os.path.isfile(filePath)): print "There it is! ;-)" else: print "Whow, file is missing at this place :-(" View Update Delete
193PythonArrayDictionary Basics# empty dict myDict = {} # some static values myDict ={ "key1" : {"item1":"value1"}, "key2" : {"itemX":"valueY"}, "keyX" : {"item99":"value98"} } # update a key programmatically myDict.update({"key1" = {"item2":"new value"}}) # iterate for (key, subdict) in myDict.items(): current_key = key current_subdict = subdict # get an specific item subdict = myDict.get("key2") print subdict.get("itemX") # valueYView Update Delete
194PythonFilehandlingFilename-Manipultation Basicsimport os myFilename = "/tmp/Test/myFile.txt" # Get only the path path_only = os.path.dirname(myFilename) # /tmp/Test # Filename only filename_only = os.path.basename(myFilename) # myFile.txt # get only filename without extention filename_without_ext = os.path.basename(os.path.splitext(myFilename)[0]) # myFile # get only the extension filename_extention_only = os.path.splitext(myFilename)[1] # .txt # put them together again myFilename_together = os.path.join(path_only, filename_without_ext + filename_extention_only) # /tmp/Test/myFile.txt View Update Delete