将os导入到j2me
我正在尝试把这段代码写成j2me格式。有没有人知道该怎么做?
谢谢!
import os
if os.path.isfile("c:\\python\\myfolder\\test.txt"):
2 个回答
0
下面的内容可能会对你有帮助。记得手机需要支持JS175哦。
try {
fconn = (FileConnection) Connector.open("file:///locaction_of_file", Connector.READ_WRITE);
if (!fconn.exists()) {
fconn.create();
}
} catch (IOException e) {
e.printStackTrace();
}
1
先弄明白这一行代码的作用。你可以从Python的
os
模块的文档开始了解:http://docs.python.org/library/os.path.html查阅J2ME的文档,找找有没有类似的函数调用。