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.
import os
os.name
# nt, posix
import platform
platform.system()
# 'Windows', 'Linux', 'Darwin'
platform.release()
# Linux, Windows, Windows, Darwin
'2.6.22-15-generic', 'Vista' ,'10', '8.11.1'
# Example from https://stackoverflow.com/questions/1854/python-what-os-am-i-running-on
from sys import platform as _platform
if _platform == "linux" or _platform == "linux2":
# linux
elif _platform == "darwin":
# MAC OS X
elif _platform == "win32":
# Windows
elif _platform == "win64":
# Windows 64-bit
# Modes
# r: Read mode which is used when the file is only being read
# w: Write mode which is used to edit and write new information to the file (any existing files with the same name will be erased when this mode is activated)
# a: Appending mode, which is used to add new data to the end of the file; that is new information is automatically amended to the end
# r+: Special read and write mode, which is used to handle both actions when working with a file
myFile = open("myFile.txt","w")
myFile.write("Hello World")
myFile.close()
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Hinweis")
.setTitle("Hinweis-Meldung")
.setNeutralButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
113
Android
GUI, Dialoge
Abfrage-Dialog
// siehe auch : http://developer.android.com/guide/topics/ui/dialogs.html
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
WhatHaveYouDoneActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
114
Android
GUI, ComboBox
ComboBox füllen
public void fillSpn()
{
String dummyarr[];
Spinner spn1 = (Spinner) findViewById(R.id.spn1);
// Dummy Data
dummyarr = new String[5];
int i;
for (i=0;i<5;i++)
{
dummyarr[i]=String.valueOf(i);
}
ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, dummyarr);
spn1.setAdapter(adapter);
}