3,386 Posted Topics
Re: Could this help (looks bit outdated though) [url]http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/pascal.html[/url] | |
Re: you are not returning anything. | |
Re: [QUOTE]without having the first table appear? [/QUOTE] I do not get it. | |
Re: To [URL="http://mail.python.org/pipermail/python-win32/2004-December/002807.html"]be in Google[/URL] or not to be? That is the question. [url]http://lmgtfy.com/?q=priority+of+process+python+windows[/url] | |
Re: What you think the slice of first elements of function shop to be like at line 10, and how is the definition of buy function depending on value of buyoption, that you should define it in if branch of definition of elif branch of other condition unknow to us. Where … | |
Re: ...and it is not really more complicated code to say: [CODE]def decode(code_dict,message): return "".join(code_dict[c] if c in code_dict else c for c in message) print(decode({"t":"x", "b":"y"}, "the quick brown fox")) [/CODE] | |
Re: Check if you need magic ;) [url]http://linux.about.com/library/cmd/blcmdl5_magic.htm[/url] | |
Re: You have only print is indented inside while. | |
Re: Maybe you could make the main script in Python and avoid being affected by setup issues. It is probably small difference how the .py extension is defined to be treated, assuming we are talking now about Windows system, not Linux etc Posix ones. | |
Re: see vegaseat examples from his sticky thread on gui programming. | |
Re: Did you check really the code snippets? I did post [url]http://www.daniweb.com/software-development/python/code/373120[/url]. | |
Re: see grouper example from itertools module documentation. | |
Re: Notice that only three first letters have effect, rest of input does not count for result. categorize three columns with the two alternative branches and third for other input(like space or punctuation) for pass. | |
Re: If possible you could answer yourself here and post relevant piece of your code (as simplified as possible) for future Googlers and DaniWebbers. Also markt the thread solved. | |
Sometimes, before optimizing your code, you may end up to have very slow running code in list comprehension statement. Because you have not yet tested the code fully, it easy to loose patience and just interrupt the code. If you are making function, you can insert print statements for verification. … | |
Re: You do not split user input to words, you should be building the new sentence without stop words, marked does not make sense. | |
Re: [QUOTE=jgalaz;1774471]How do you do this when the elements of the list are dictionaries? Using sets won't work in that case. Python complains because dictionaries are not "hashable". For example, I want a function that will tell me which elements of A are in B (the intersection of the two lists), … | |
Re: @vegaseat: that infamous +1 again. We need space for Zorro also, don't we. | |
Re: cdef means it is prepared to run with cython. You must remove those. Something like: [CODE]import os import re d = 'O:\Documents and Settings\Veijalainen\Omat tiedostot' totpages = 0 for f in (pf for pf in os.listdir(d) if pf.endswith('.pdf')): fn = os.path.join(d,f) with open(fn, 'rb') as pdf: for line in pdf: … | |
Re: Read and experiment this part of the tutorial of python.org, I would like to encourage to go through all of the tutorial and experiment with variations of example code. [url]http://docs.python.org/tutorial/controlflow.html[/url] | |
Re: The () are not closed properly at line 7, the variables rock, paper, scissors are not defined. | |
Re: I converted the 2.7 script normally with the 2to3 utility script and it did not need any manual tuning. | |
Re: use enumerate:[CODE]for column, value in enumerate(row):[/CODE] | |
Re: Here is the trivial solution, probably you have some rules, what you can use and what not? [CODE]>>> def attenuate(sequence1, without): return ''.join(c for c in sequence1 if c.lower() not in without) >>> attenuate('IamLearningPython', 'aeiou') 'mLrnngPythn' >>> [/CODE] | |
Re: Maybe there is limit also for which numbers can be negative. | |
Re: And where we can see your code/documents? | |
Re: # what femaleSiblings? Set totalSavings = femaleSiblings(Savings) # why female in the name? where parameter Savings is declared? Function femaleSavings(Savings) as float | |
![]() | Re: Simplest would probably be to use split with second argument 1 or partition method four times and return or yield those as values, joining together if you really need the lines as one chunk. |
Re: You have not used code tags, but even you have not indetion at all (which would come visible in quoted text after pushing reply button)! | |
Re: Even this is not robust code in Python as the number of recursion calls is limited, here for comparison the recursive way: [CODE]def randomSteps(minStep, maxStep, distance): randomstep = random.randint(minStep, maxStep) return 1 if distance <= randomstep else 1 + walkingMan(minStep, maxStep, distance - randomstep)[/CODE] | |
Re: It is good to learn to use database when appropriate, but for more direct route to python there seems to be various dbf modules available [url]http://dbfpy.sourceforge.net/[/url] | |
Re: Call len for list and return first element if len=N, else find Nth last or the list minus the first element. This is very inefficient way, but one that came to my mind (len function of list is by itself as heavy as finding nth last element). That two pointer … | |
Re: "Can't get it to work" is not helpfull comment, post the Error messages verbatim. Also help how did you tried to debug the program based on the error message. Debugging is essential skill in programming and we do not want to make you not to learn it. | |
Re: You break out of loop without calculations and you have problem with syntax. If you use input in Python2 you can just input the calculation normally 3.234 + 23.12312 as it runs the expression through eval. It is not so safe though, so use raw_input allways: [CODE]while True: print "Welcome … | |
Re: Here looks to be some videos, just google for web2py. [url]http://www.youtube.com/watch?v=53DF4pkeriU[/url] | |
Re: For me it is ununderstandable why on earth you would count spaces. | |
Re: Procedure learn python: 1) Stop double posting your question, when somebody does not do your homework 2) Think about the problem 3) Analyze what you need to solve the problem 4) Check the documents, examples of teacher, example codes in sticky messages of Daniweb and code snippets archive for examples … | |
Re: You did not post what you have done and what is your current specific problem. | |
Re: And could you not use ready code snippets like [url]http://www.daniweb.com/software-development/python/code/383201[/url] as example? | |
Re: 1st line beginning 1st line 0th to 5th letter, I think. Same as "Hello, World"[0:5] | |
Re: Without knowing matlab, it looks like you are not splitting the line for individual numbers, usually str2num style function work on single number. Could be different in matlab though.. Googled it out ([url]http://www.mathworks.com/matlabcentral/fileexchange/4615-split-delimiter-separated-strings-into-a-matrix[/url]) and it does seem to be able to handle multiple numbers as long as you tell it … | |
Re: This is how I would do it: [CODE]import webbrowser block = {} with open('roeland_input.txt') as data, open('roeland_output.txt', 'w') as result: collected_data = [] keys = set() for line in data: if '=' not in line: collected_data.append(block) block = {} else: sym, eq, val = line.partition('=') block[sym] = int(val) keys.add(sym) collected_data.append(block) … | |
Re: We are fortunate to have exact and economical documentation in our help files and through internet python.org website plus many additional resources like daniweb.com code snippet archives after you grasp basics. [url]http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files[/url] | |
Re: You just do undecoding with -most frequent code + code for most common letter to do opposite shift. | |
Re: This is basic thing, read tutorial: [url]http://docs.python.org/library/stdtypes.html#string-methods[/url] | |
Re: Looks like the job for Queue module: [url]http://effbot.org/librarybook/queue.htm[/url] | |
Re: Without actually running it, looks infinite recursion as last predicate is same as lhs of the rule Put another variable there, same variable can not unify with two values (forget assignment same varible name means exactly same value in Prolog) actually thinking about it the last statement is junk, remove … | |
Re: Do not use absolute goto unnecessary, your code is not according to idea of turtle graphics. You could check my histogram code from code snippets for example of loop with turtle graphics. | |
Re: could you not use single instance of client? How the client gets the file name for the chunk of message? Good start at least to remove those ugly cryptic variable names, string is kind of so so as name still. | |
Re: Do you mean: [CODE]>>> matrix = [[2,4,6,8],[10,12,14,16],[20,22,24,26],[28,30,32,34]] >>> print any(28 in sub for sub in matrix) True [/CODE] This only return the truth value if it is in the list like you discribe as your point one. However it looks like you want to actually return the row, column: [CODE]>>> … |
The End.