- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 30
- Posts with Upvotes
- 25
- Upvoting Members
- 17
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
75 Posted Topics
![]() | Re: A Separation (or Separation of Nader and Simin) by Asghar Farhady. The Dreamers. Forest Gump. |
Re: Importing modules inside anonymous functions: t = lambda: __import__('time').localtime() print('Date: %s/%s/%s'%(t().tm_mday, t().tm_mon, t().tm_year)) | |
Re: PyScripter is the best one in my opinion. it supports many versions of Python code.google.com/p/pyscripter/ | |
Re: > for example I don't know what this is called » [('cat', 'meow'), ('dog', 'ruff')] It's called a list of tuples > so I can now remove the square brackets but I want to make it liek this ↴ catmeow dogrugg You can do something like this: your_list = [('cat', … | |
Re: off topic but wise ;-) Where shall I begin, please your majesty?" he asked. "Begin at the beginning", the king said, gravely, "and go on till you come to the end: then stop ." Alice in wonderland. | |
Re: def main(): with open(raw_input("Enter file name: ", "r")) as fin: for num, line in enumerate(fin.readlines()): print("%d: %s"%(num+1, line)) it is without error checking, u you can add exception catching to it. | |
Re: and... the module profession.py returns nothing! so your player will not have any of those properties. | |
Assuming that every person has a National ID number, I am trying to check if the Entered number is a valid ID number, under these conditions: 1. ID number must be of 10 digits length. 2. If ID length is greater than/equal to 8 and less than 10 digits, add … | |
Re: I'm using py4a on android and it helps me script things for my android phone. stuff like searching messages for desired words, text encryption and sending via sms reboot options for root devises bluetooth control with gui and some more, I scripted already. | |
Re: what OS does it have? Android/iOS/Win Mobile? | |
Re: just write down some code and then try to enhance it step by step. then come back here and ask your questions. what is yor algorithm or logic? | |
Re: first no need to use print when assigning a user input to a variable. secondfunction arguments are pre-requisit for function. so get those two user input vars out of the function. | |
Re: just something to start with: data_list = [line.split() for line in myFile.readlines()] | |
Re: python uses (* asterix) for multiplication. in line 54 it assumes the s(s-side1) as a function call not a multiplication. it should look like s*(s-side1)*(s-side2)... | |
Re: I dont know wx and dont know how to fill searchbox :D but for searching a word or words u can add queries to google address: www.google.com/search?q=SEARCH+WORDS query = 'what is Python' search_google = 'www.google.com/search?q=%s'%query | |
Re: you have to assign thevariable before using it. in your case, replace the line 1 and 2 with each other. in python 2.x use raw_input instead of input and then convert it to integer or float. | |
Re: what structure has the data in the text file? show some of its data. btw, range() doesnt work with float. | |
Re: define get_score(with a string argument): length = len(string) score = 0 if length < 3: score = 0 elif score > 6: score = length multiplied by 1 elif other condition: apply other rules to score ... return score | |
Re: instead of confusing while MainLoop == 1 you can use: while True: '''do stuff''' break | |
Re: EDIT. PLEASE REMOVE THIS POST. my system got problem when tried to post :D long delay in refresh, | |
Re: Book: Think Java. it is really a cool book :) | |
Re: look at the full traceback record. and it's better to post the full traceback here... | |
Re: you should return shipping_rate in the second function: def shippingRate ( poundage , classification ): return poundage * classification | |
Re: what is your targeted devise? if sysmbian: import inbox box = inbox.Inbox(inbox.EInbox) for sms_ID in box.sms_messages(): print box.content(sms_ID) | |
Re: if you mean to write and run code, there is no support for python 3.3. SL4A only supports 2.6.2 and 3.0.1. | |
Re: post your code and traceback if you want to attract forum's experts attention. otherwise you wont get any help ;) | |
Re: simplest way: url= 'http://maps.google.com/maps?q=%s+%s' % (latitude,longitude) | |
This is me with another project for beginners :) The Project as stated by ZZucker about 2 months ago: "Given the length of three sides, write a function that checks if it is possible to create a triangle." I could solve it with an annonymus function like this: is_triangle = … | |
Re: you can repeat your code for every word in string.split then join them at the end. | |
This is and answer to one of the Vegaseat's recent projects for beginners. I share my solution here because -as a begginer and do learn python as a hobby- I need your feedback. So please tell me am I doing it the right way? Thanks in advance for comments from … | |
Re: a ')' at the end of line 1 is missing: celsius = float(input("What is the Celsius temperature? ")) | |
this is my first attempt to implement OOP. IS this class ok?(in terms of structure) AND another Question: there are some folders in message application in Symbian phones and sometimes there are up to 1000 messages in each folders. I do itterate over all messages for gathering their info about … | |
Re: All the Info you need, is accessible through the API documentation: menu > help > API help > bluetooth facade. from android import Android droid = Android() check = droid.checkBluetoothState().result if check != 1: droid.toggleBluetoothState(1,0) print "Bluetooth turned ON!" droid.bluetoothMakeDiscoverable(300) print "Bluetooth is Discoverable for 300sec now" else: droid.toggleBluetoothState(0,0) print … | |
Re: Try the TopWindow module for the graphics and those Icons (actually they are not icons but images that are linked to an app uid for App Run). the cursor is an image too and moves by defined keys(e.g. left/right arrow keys) via a redraw callback. Implementing graphics like these is … | |
Re: pyo, is os dependent i think, and there is no way to compile a py to pyo on the phone. you can compile or decompile py/pyc files using many apps out there as symbian packages (e.g. BestDeCompiler.sis). if you make a pyo on pc from a pys60 script, i think … | |
Re: there is no example needed. just pack your script with py2sis application and type y for autostart in its wizard. thats it. | |
Re: the most widely used pys60 is v1.45 and is a port of python 2.2.2. the pys60 v1.9.7 that is a python 2.5 port that is less used. for pys60 there are many modules for manipulating files and dirs, as an example I can suggest the pow_light fm module or fman … | |
Re: ordertype = raw_input(" Is the order for pickup or delivery? ") while True: if not (ordertype.lower() in ["p","d"]): print "No, Enter only P or D!" ordertype = raw_input("Is the order for pickup or delivery? ") else: print "Ok, %s Entered" %ordertype break | |
Re: split the RNA sequence at the midline and reverse the second part then compare the 2parts. something like a function that takes the sequence and returns the following: return sequence[:len(sequence)/2]==sequence[len(sequence)/2:][::-1] | |
How the following code can be rewritten in a better way? #!/usr/bin/env python """Simple program for finding popular names over last 100 years, in response to vegaseat's last post in Projects for Beginners(9/1/2012). It first lists the popular names and then search for entered name by user""" oldnames = """Mary,Helen,Margaret,Anna,Ruth … | |
Re: no need to open and close the file several times. for names printing in different lins you can strip the end of line symbol. a simple function is what I would use: import random def name_gen() query = raw_input("Whould you like to generate a random name? y/n") if query == … | |
Re: http://www.diveintopython.net/ | |
Re: @ Jacklittle01: A friendly Advise, Spamming at the board and asking a question many times is waste of time. I think it'd be better to start learning Python by first reading some tutorials or introductory texts then pick up simple practices for every method, data type and so on. after … | |
Re: The very first thing to learn in any situation is THE RULES. And Python has few rules such as Indentation, Style and.. that you need to learn first. def some_function(): #some notes here while some_condition: if some_other_condition: some=process+here else: some=other*process+here | |
Re: Using the SL4A is a simple and good choice, for securing your script you can Compile it as a *.pyc file and run it from another script via importing it. Or, you can make an apk file and then pass it toyour friends. i think installing SL4A and Py4A is … | |
![]() | Re: if you want it to work with every site,I guess you need to consider the encoding too: print sourcecode.decode("utf8") |
Re: I dont know why but extend adds 'devide' as another list to oper. I couldn't find "extend" function for lists! Strange and amazing, using new line in second example somehow works like a "+" opperator. but fails when we use a variable instead of a string. the below works as … | |
![]() | Re: from os import path PATH = "folder_path/file.txt" if path.exists(PATH) and path.isfile(PATH): print "File does exist" else: print "File doesn't exist!" ![]() |
Re: as pyTony said, It only finds the cells containing "CYP", and ignores the cells containing "Cyp" | |
Re: I'm not familiar with AT commands, but, what if you use a longer time.sleep()? because those commands are very fast and phone needs more time to respond. |
The End.