Support Forums

Full Version: Can anyone do python to java conversions?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
chr()

len()

ord()

list()

n = []

n.append

Thanks for any conversions you can make. I'll keep looking through http://java.sun.com/javase/6/docs/api/
Solved one:
n=[]
in java is:
char data[] = {}
I dont understand what those methods/functions in Python do. I can however convert them if i know their task. What do these do;
Code:
chr()

len()

ord()

list()

And I know the append() method. Are you trying to append text through a GUI or just through the use of writing to something?
(12-01-2009, 02:05 PM)Project Evolution Wrote: [ -> ]I dont understand what those methods/functions in Python do. I can however convert them if i know their task. What do these do;
Code:
chr()

len()

ord()

list()

And I know the append() method. Are you trying to append text through a GUI or just through the use of writing to something?

Just through the use of writing something.
I also find len() it is String.length()
as for chr and ord
chr(97)
outputs a. I believe its hex
and ord('a') outputs 97, Its the opposite of chr
Quote:String buffers are used by the compiler to implement the binary string concatenation operator +. For example, the code:


x = "a" + 4 + "c"
is compiled to the equivalent of:


x = new StringBuffer().append("a").append(4).append("c")
.toString()

StringBuffer Class
http://java.sun.com/j2se/1.3/docs/api/ja...uffer.html

append(String str)
http://java.sun.com/j2se/1.3/docs/api/ja...ng.String)

Understand?
Also, if your thinking of appending text to lets say a .txt file, use Java's write() method located in I/O.
(12-01-2009, 07:34 PM)Project Evolution Wrote: [ -> ]StringBuffer Class
http://java.sun.com/j2se/1.3/docs/api/ja...uffer.html

append(String str)
http://java.sun.com/j2se/1.3/docs/api/ja...ng.String)

Understand?
Also, if your thinking of appending text to lets say a .txt file, use Java's write() method located in I/O.

Thanks