3,386 Posted Topics

Member Avatar for kolibrizas

Could this help (looks bit outdated though) [url]http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/pascal.html[/url]

Member Avatar for TrustyTony
0
86
Member Avatar for boiishuvo
Member Avatar for inuasha
Member Avatar for Gribouillis
0
218
Member Avatar for floatingshed

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]

Member Avatar for floatingshed
0
161
Member Avatar for AJkiter

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 …

Member Avatar for TrustyTony
0
109
Member Avatar for lfmconsummates

...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]

Member Avatar for lfmconsummates
0
187
Member Avatar for crag0

Check if you need magic ;) [url]http://linux.about.com/library/cmd/blcmdl5_magic.htm[/url]

Member Avatar for TrustyTony
0
180
Member Avatar for AJkiter
Member Avatar for floatingshed

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.

Member Avatar for floatingshed
0
202
Member Avatar for moroccanplaya
Member Avatar for chopper25

Did you check really the code snippets? I did post [url]http://www.daniweb.com/software-development/python/code/373120[/url].

Member Avatar for woooee
0
594
Member Avatar for floatingshed
Member Avatar for london-G

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.

Member Avatar for london-G
0
102
Member Avatar for iraj.jelo

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.

Member Avatar for TrustyTony
0
182
Member Avatar for TrustyTony

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. …

Member Avatar for Gribouillis
1
1K
Member Avatar for boiishuvo

You do not split user input to words, you should be building the new sentence without stop words, marked does not make sense.

Member Avatar for HiHe
0
830
Member Avatar for R.S.Chourasia

[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), …

Member Avatar for TrustyTony
0
6K
Member Avatar for MegaMan15
Member Avatar for TrustyTony
0
222
Member Avatar for ozzyx123

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: …

Member Avatar for TrustyTony
0
881
Member Avatar for Vkitor

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]

Member Avatar for Gribouillis
0
23K
Member Avatar for layneb131

The () are not closed properly at line 7, the variables rock, paper, scissors are not defined.

Member Avatar for layneb131
0
197
Member Avatar for moroccanplaya

I converted the 2.7 script normally with the 2to3 utility script and it did not need any manual tuning.

Member Avatar for moroccanplaya
0
163
Member Avatar for straylight
Member Avatar for woooee
0
169
Member Avatar for jone kim

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]

Member Avatar for TrustyTony
0
204
Member Avatar for KatseasSAvvas
Member Avatar for zeeya
Member Avatar for Japp007

# what femaleSiblings? Set totalSavings = femaleSiblings(Savings) # why female in the name? where parameter Savings is declared? Function femaleSavings(Savings) as float

Member Avatar for Japp007
0
1K
Member Avatar for apeiron27

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.

Member Avatar for woooee
0
98
Member Avatar for bebedjou

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)!

Member Avatar for woooee
0
2K
Member Avatar for unigrad101

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]

Member Avatar for slate
0
130
Member Avatar for roe1and

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]

Member Avatar for woooee
0
300
Member Avatar for ChPravin

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 …

Member Avatar for rexslahed
0
1K
Member Avatar for python-noob

"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.

Member Avatar for python-noob
0
430
Member Avatar for pythoner

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 …

Member Avatar for pythoner
0
180
Member Avatar for Netcode

Here looks to be some videos, just google for web2py. [url]http://www.youtube.com/watch?v=53DF4pkeriU[/url]

Member Avatar for Netcode
0
104
Member Avatar for minimee120
Member Avatar for markusd5454

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 …

Member Avatar for TrustyTony
0
156
Member Avatar for JOSED10S

You did not post what you have done and what is your current specific problem.

Member Avatar for JOSED10S
0
201
Member Avatar for Tadmir

And could you not use ready code snippets like [url]http://www.daniweb.com/software-development/python/code/383201[/url] as example?

Member Avatar for TrustyTony
0
2K
Member Avatar for moroccanplaya

1st line beginning 1st line 0th to 5th letter, I think. Same as "Hello, World"[0:5]

Member Avatar for moroccanplaya
0
1K
Member Avatar for osfar

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 …

Member Avatar for TrustyTony
0
166
Member Avatar for roe1and

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) …

Member Avatar for roe1and
0
308
Member Avatar for KickAssElmo

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]

Member Avatar for KickAssElmo
0
234
Member Avatar for Yoink

You just do undecoding with -most frequent code + code for most common letter to do opposite shift.

Member Avatar for TrustyTony
0
355
Member Avatar for HoneyBadger

This is basic thing, read tutorial: [url]http://docs.python.org/library/stdtypes.html#string-methods[/url]

Member Avatar for HoneyBadger
0
158
Member Avatar for floatingshed

Looks like the job for Queue module: [url]http://effbot.org/librarybook/queue.htm[/url]

Member Avatar for floatingshed
0
376
Member Avatar for phorce

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 …

Member Avatar for phorce
0
171
Member Avatar for minimee120

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.

Member Avatar for minimee120
0
164
Member Avatar for xopenex

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.

Member Avatar for TrustyTony
0
201
Member Avatar for jone kim

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]>>> …

Member Avatar for jone kim
0
242

The End.