Discussion Board
Some Tips for newbies
2005-06-07, 22:02
#1
Registered User
hi all i have some tips for real newbies (like me) ye i'm newbie to python and symbian!
1°) howto list the functions available in a module:
import <module_name>
dir(module_name)
Examples:
a)
>>> dir(e32)
['Ao_lock', '__doc__', '__name__', '_as_level', '_mem_info', '_stdo', '_uidcrc_a
pp', 'ao_callgate', 'ao_sleep', 'ao_yield', 'drive_list', 'file_copy', 'is_ui_th
read', 'start_exe', 'start_server']
b)
>>> import messaging
>>> dir(messaging)
['__doc__', '__file__', '__name__', 'sms_send']
c)
>>>import location
>>> dir(location)
['__doc__', '__file__', '__name__', 'gsm_location']
2°)howto show the type returned by a function:
import types
import <the_module_name_of_the_function>
type(<function_name(<arguments>)>)
Examples:
import types
import location
>>> type(location.gsm_location())
<type 'tuple'>
>>> type(u" ")
<type 'unicode'>
>>> type(' ')
<type 'str'>
i hope that will help,
Ibrahima
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules