| Reply | « Previous Thread | Next Thread » |
|
first,thank everyone have helped me,I'm from China,my English is not good…
like the title,I want to list them with 'Listbox',and when I select one of them,can rename it,write it for example,if 'a.text' and 'b.text' are in the dir'e:\c\',l write it like this: >>> import os >>> os.listdir('e:\\c\\') it will print: ['a.text', 'b.text'] >>> now I want kown the code,when I have got the list,how to list the file though 'appuifw.app.body=appuifw.Listbox( , )',that I can select 'a.text' and creat.can you tell me the whole code,thanks very much could you understand?I think it's terrible that I did not learn English hard
Last edited by anyko38155285 : 2008-07-03 at 14:42.
|
| anyko38155285 |
| View Public Profile |
| Find all posts by anyko38155285 |
|
Hi anyko38155285 ,
Your question is not clear could you please explain it. IDEAS is all they need but still they think only Genius can give them that. |
| shubhendra |
| View Public Profile |
| Find all posts by shubhendra |
|
i have revised it,you are so early,aha
|
| anyko38155285 |
| View Public Profile |
| Find all posts by anyko38155285 |
|
I really cant understand the question now also.
IDEAS is all they need but still they think only Genius can give them that. |
| shubhendra |
| View Public Profile |
| Find all posts by shubhendra |
|
Quote:
Check out this article which would solve your problem How to search a file extension You need to search .txt files in E:\\a so modify the path and file_extension variable accordingly. Best Regards, Croozeus |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Online
Forum Nokia Champion
|
|
hi anyko38155285
dont worry about your English it will become good. now as far as your problem is concerned croozeus has already given you the wiki link. that will help. moreover as far as i understand you want to change the name of the the file you selected am i correct???? Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
yes.for example,if 'a.text' and 'b.text' are in the dir'e:\c\',l write it like this:
>>> import os >>> os.listdir('e:\\c\\') it will print: ['a.text', 'b.text'] >>> now I want kown the code,when I have got the list,how to list the file though 'appuifw.app.body=appuifw.Listbox( , )',that I can select 'a.text' and creat.can you tell me the whole code,thanks very much |
| anyko38155285 |
| View Public Profile |
| Find all posts by anyko38155285 |
|
Quote:
1) List all the files in the folder with the os.listdir function. 2) Check for the extension, Append the entries which have the required extension - .txt You will need to use a for or a while loop for doing the two steps. For appending the entries you need to have an empty array set up. Like Quote:
Quote:
Hope that helps, btw, I think you must read this Fishing for information Best Regards, Croozeus |
|
thanks for your helping.
the proverb is truth |
| anyko38155285 |
| View Public Profile |
| Find all posts by anyko38155285 |
|
Here's a quick mockup:
Code:
items = []
for name in os.listdir('e:\\some\\directory'):
if os.path.splitext(name)[-1].lower() == '.txt':
items.append(name)
def select_click():
name = items[appuifw.app.body.current()]
path = os.path.join('e:\\some\\directory', name)
appuifw.note(u'Selected: %s' % path.decode('utf8'))
appuifw.app.body = appuifw.Listbox([x.decode('utf8') for x in items], select_click)
.The decode() method is a better choice to convert a path/filename to unicode than unicode() because it works properly if the filename contains non-ascii characters. This code displays a list of .txt files in some directory and allows you to click on them. Clicking pops up a note with a full path to the file. |
|
Quote:
|
| anyko38155285 |
| View Public Profile |
| Find all posts by anyko38155285 |
|
i have a question, given that you can access the txt file and append new entries in it, once i convert the whole code to sis, would i need more than just the user capabilities during the signing? would the ReadUserdata and WriteUserdata suffice the need for file access and modification.
I am working on making a log. E.g. every text msg sent via python, i would make a log and append it to an existing text entry in a text file. Thanks. |
| pacificace |
| View Public Profile |
| Find all posts by pacificace |
|
Quote:
Best Regards, SajiSoft "The purpose of software engineering is to control complexity, not to create it." --§ajid Ali Anjum-- http://sajisoft.wordpress.com/ |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| File Browsing Problem | Marwa | Mobile Java Networking & Messaging & Security | 13 | 2007-10-10 16:52 |
| Change the List type of the LIST ??? | divyas | Mobile Java General | 2 | 2006-09-15 21:27 |
| 6680 and bluetooth service profiles | ceruault | Mobile Java Networking & Messaging & Security | 1 | 2005-10-08 23:24 |
| Bluetooth Virtual Serial Port | mealos | Bluetooth Technology | 2 | 2004-12-03 04:46 |
| List item selection | SanDan | Mobile Java General | 2 | 2003-05-06 11:57 |