带着java学python
python正文: 和其它语言一样,我们可以以命令行的形式给你的python程序传递参数,pyhton能够自动把命令行参数以字符串列表的形式存储在sys模块的arv变量。ok,我们先来看个例程:
# 文件名: printargs.py
#用途:演示python的传参
import sys
print sys.argv
在命令行输入:python printargs.py aaa bbb ccc
输出结果:['E:\\development\\python\\test\\src\\test.py', 'aaa', 'bbb', 'ccc']
其中:sys.argv[0]=E:\\development\\python\\test\\src\\test.py
sys.arg[1]=aaa 依次类推......
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
同功能Java代码 :
/**
*@author jmp esp
*
*
*/
public class PrintArgv {
&nb
相关文档:
本篇旨在帮助准备学习Java以及刚接触Java的朋友认识、掌握和使用static、this、super、final这几个关键字的使用。Java博大精深,我也是一位正在学习和使用Java的爱好者,文中难免有不妥之处,欢迎指正。
一、static
请先看下面这段程序:
public class Hello{
public static void main(String[] args){ ......
import java.net.URL;
import java.net.URLDecoder;
public class PathUtil
{
/**
* Get the env of windir, such as "C:\WINDOWS".
* @return the env of windir value.
*/
public static String getWindir(){
return System.getenv("windir");
}
......
/*Decryptor*/
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
/**
* Decrypt the password get form Xpress GUI
*/
public class Decryptor{
//加密
  ......
对于10进制数转换为N(2-36)进制一般都是选择取余除的算法进行转换 ,下面给出两种方案
一种是递归,一种是迭代。通过效率评价两者性能
其中迭代的方案直接取自java源代码。
/*
*Class NotationConvert.java
*Create Date: 2009-11-12
*Author:a276202460
*/
package com.rich.notation;
public class Notat ......