List: less,equal,greater: tuple of results
Sunday, July 19th, 2009L1 = [1, ('a', 3)]
L2 = [1, ('a', 2)]
print L1 < L2, L1 == L2, L1 > L2 # less,equal,greater: tuple of results
L1 = [1, ('a', 3)]
L2 = [1, ('a', 2)]
print L1 < L2, L1 == L2, L1 > L2 # less,equal,greater: tuple of results
print len([1, 2, 3]) # length
using System;
using System.Reflection;
using System.Collections.Generic;
class MainClass {
public static void Main(string[] args) {
AssemblyName assembly1 = new AssemblyName("com.microsoft.crypto, Culture=en, PublicKeyToken=a5d015c7d5a0b012, Version=1.0.0.0");
List<AssemblyName> assemblyList = new List<AssemblyName>();
assemblyList.Add(assembly1);
AssemblyName ass2 = assemblyList[0];
Console.WriteLine("\nFound AssemblyName in list: {0}", ass2);
}
}
a = ['spam', 'eggs', 100, 1234]
print a[0]
print a[3]
print a[-2]
print a[1:-1]
print a[:2] + ['bacon', 2*2]
print 3*a[:3] + ['Boo!']
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.List;
import com.lowagie.text.ListItem;
import com.lowagie.text.Paragraph;
import com.lowagie.text.html.HtmlWriter;
import com.lowagie.text.pdf.PdfWriter;
public class ListAndSublistPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream("ListAndSublistPDF.pdf"));
document.open();
document.add(new Paragraph("Text Text Text :"));
List list = new List(false, 20);
list.setListSymbol(new Chunk("\u2022", FontFactory.getFont(FontFactory.HELVETICA, 20, Font.BOLD)));
ListItem listItem = new ListItem("Item 1");
list.add(listItem);
List sublist;
sublist = new List(false, true, 10);
sublist.setListSymbol(new Chunk("", FontFactory.getFont(FontFactory.HELVETICA, 8)));
sublist.add("A");
sublist.add("B");
sublist.add("C");
sublist.add("D");
list.add(sublist);
listItem = new ListItem("Item 2");
list.add(listItem);
sublist = new List(false, true, 10);
sublist.setFirst(‘a’);
sublist.setListSymbol(new Chunk("", FontFactory.getFont(FontFactory.HELVETICA, 8)));
sublist.add("A");
sublist.add("B");
sublist.add("C");
sublist.add("D");
list.add(sublist);
listItem = new ListItem("Item 3");
list.add(listItem);
sublist = new List(false, true, 10);
sublist.setListSymbol(new Chunk("", FontFactory.getFont(FontFactory.HELVETICA, 8)));
sublist.add("A");
sublist.add("B");
sublist.add("C");
sublist.add("D");
list.add(sublist);
document.add(list);
} catch (Exception ioe) {
System.err.println(ioe.getMessage());
}
document.close();
}
}