15,181 Topics

Member Avatar for
Member Avatar for novice20

Hi all, Here is a part of my code: [CODE]#-- if the ports are mapped properly if(map_dict1[int(MIO_outports1[i])] == int(Exp_map_inport[i]) ): flag = 1 elif(map_dict2[int(MIO_outports1[i])] == int(Exp_map_inport[i])): flag = 1 else: flag = 0 [/CODE] But I am not able to navigate to the 'elif' part. I am getting : [CODE] …

Member Avatar for TrustyTony
0
275
Member Avatar for potchi

Hi! I have a batch file (potchi.bat) that contains the lines ... set maxHeap = 2048 set initialHeap = 512 set mydir=%cd% ... and I want to pass these values to a jython script (myScript.py) such that fullpath = '%cd%/myApp.war' AdminApp.installInteractive(fullpath, -contextroot myApp) AdminTask.setJVMMaxHeapSize('[-serverName myServer -nodeName myNode -maximumHeapSize %maxHeap%]') AdminTask.setJVMInitialHeapSize('[-serverName …

Member Avatar for potchi
0
1K
Member Avatar for cool0329

hi guy just started python, i have a text here and want wo find the number of each letters, and sort the number from the most frequent to the least frequent. hope you guys can hepe me here is the text, just some random letters, acbbmnhctrgnmmxfnfbmqrhnchfwcqwtacvtfhmecttvfcnvphchmpgdmebjdcqwhdfnfrcawhdfrkanahtcjaqxahpkmqdardfcnhcqwjmprdcttvfpkdftwaqbmnfhdcqhdarcrhdfzmnwrzfnfrkmsfqhdfjkcrrfwhdnmpxdhdfzcttcqwrhmmwpkmqcqmkfqgmpqhnjnmcwzahdeaftwrmqfahdfndcqwhdfgahjdcwfqhanftjlcqardfwqmhclfrhaxfmeahzcrhmvfrffqhdfwcnsqfrrcqwhdfbarhdcwlcqardfwzahdahemnahzcrcgtfcngmtwzaqhfnwcjzahdrqmzpkmqhdfxnmpqwxmmwdfclfqrcawrgnmmxfgtcrkaqxdar

Member Avatar for raptr_dflo
0
428
Member Avatar for TrustyTony
Member Avatar for raptr_dflo
0
1K
Member Avatar for kiracho

write a python program , which takes one argument ,which is a word( as a string), and returns "true" if the word contains alternating vowels and consonants(i.e a consonant , followed by a vowel , followed by a consonant ....). Then write a short piece of code to read the …

Member Avatar for vegaseat
0
312
Member Avatar for WolfShield

I have a lot more code than I'm going to post here, but I am posting the relevant parts. What I have is a Calculator program. Here's the code: [CODE=Python] num1 = None num2 = None oper = None def calculate(num1, num2, oper): print("calculate() called") if(oper=="+"): answ = Decimal(num1) + …

Member Avatar for woooee
0
256
Member Avatar for VulcanDesign

Hi all, I'm trying to use Python's urllib to get a Facebook profile page. I get the following error: [CODE]IOError: [Errno socket error] [Errno 10035] A non-blocking socket operation could not be completed immediately[/CODE] Here's my code: [CODE] import urllib member_profile_text = urllib.urlopen('http://www.facebook.com/profile.php?id=1073109649').read() [/CODE] I need to get this working …

Member Avatar for VulcanDesign
0
538
Member Avatar for TrustyTony

[I]This is one idea for thread of some lessons learned with experience about asking wrong question and answers 'thinking out of box'. If there is need to have sticky, I suggest that this thread become sticky development thread and moderator can move the upvoted suggestions for next part in new …

Member Avatar for TrustyTony
0
221
Member Avatar for [V]

Ive noticed print() includes linebreaks, and its real easy to suppress them. Is there a way I can write lines to a file, but have the line breaks includes implicitly? eg: [CODE] file=open("testfile.txt","w") file.write("line 1") file.write("line 2") file.write("line 3") file.close() [/CODE] meanwhile the file will contain [code] line 1\nline 2\nline …

Member Avatar for vegaseat
0
131
Member Avatar for TrustyTony
Member Avatar for TrustyTony
0
909
Member Avatar for imperialguy

Platform and Python installation info: [b]Platforms: Windows, OS X Python: Active State Python 2.7 wxPython: Version 2.9[/b] Here is a sample code in which I use a wxMessageBox: [code]import wx,os class Frame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(100, 100),style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | …

Member Avatar for vegaseat
0
1K
Member Avatar for Toikkala

Hi! On school we got exercise to calculate how much the length of substance grow when we know original length and temperature change. So,the case goes that i have value temperature coefficient of different substances and i have to multiply them. I'd like to it without doing several condition statements. …

Member Avatar for woooee
0
250
Member Avatar for [V]

For some reason, I can create temp files but I cannot write to them. Nothing is saved, and the file is always empty. What am I doing wrong? I've tried making it in /tmp, Ive specified mode=w+b, they all do the same. (nothing) [CODE] import tempfile def main(): test = …

Member Avatar for woooee
0
235
Member Avatar for Schol-R-LEA

I am making a last-ditch effort to get Django 1.3 configured to talk to SQL Server (both running on the same Windows 7 system), before I have to make a final decision whether to move on to ASP.NET instead. I am using PyODBC (I had tried PyMSSQL but was recommended …

Member Avatar for Schol-R-LEA
0
860
Member Avatar for Ephexeve

I am reading a Python book for Pyton 2.5 (But I am doing Python 3). I am at the chapter classes and I got this part; "You can check whenever the function attribute was callable." [CODE]callable(tc,'talk',None)[/CODE] In Python3 we do not have callable anymore, so I checked on the internet, …

Member Avatar for TrustyTony
0
268
Member Avatar for Gsx

Hi, this program is working atm but i suck at loops and such and im just wondering if there is any better way to do it, and if i do not enter a number in 1 of the 3 boxes when showing the results of the networks it just says …

Member Avatar for TrustyTony
0
154
Member Avatar for rssk

hi all i have list like list1=[2,3,4] m = 'ma' [B]m = list1 * m[/B] wen i run the script i'm getting output like [B]TypeError: can't multiply sequence by non-int[/B] i need a output like [B][ma2,ma3,ma4][/B] so plzzzzz help me:(

Member Avatar for TrustyTony
0
220
Member Avatar for BLUEC0RE

Hey guys, I'm tinkering around with the fuse-python bindings and I can't seem to grasp how to run the example xmp.py from the library package (xmp.py is located here: stuff.mit.edu/iap/2009/fuse/examples/xmp.py). Looking at a lecture slide from MIT (located here: stuff.mit.edu/iap/2009/fuse/fuse.ppt), on slide 33, it shows the command line invoking of …

Member Avatar for BLUEC0RE
0
128
Member Avatar for WolfShield

Hey all, I am working on a calculator program and am using a StringVar() for the Entry widget. What I need is to delete the last char from the StringVar() when the user hits the 'Backspace' button. I have everything bound and all, I just don't know what the code …

Member Avatar for WolfShield
0
1K
Member Avatar for happymadman

Where are the connections stored, are they in a list, how to I access them? I have a (-messy-) program that will allow the users to set there name and when they send input to the server it will come up with "Received: Blah from username" but I would like …

Member Avatar for happymadman
0
107
Member Avatar for Simplicity.

Hi all, I have developed the code below to solve a non-linear scalar hyperbolic conservation law (Burgers' equation). I want to advance to solving a one dimensional system of Euler equations for Gas Dynamics (which is also a hyperbolic partial differential equation) in the similar manner. Can anyone advise on …

Member Avatar for TrustyTony
0
193
Member Avatar for ret801

can someone show me the syntax for inserting Number literals and strings into python strings like the print statement for example(i.e print("string %s"),(SumNum)) .. I have forgotten. and could someone explain the difference between syntax and semantics to me , i have forgotten that also XD

Member Avatar for ret801
0
136
Member Avatar for WolfShield

Hi, I am running Windows Vista. I am trying to run a .py file, but the computer says it doesn't know what program to run it with. So, I clicked 'Choose Default Program', then I found 'python.exe' and clicked it. But 'python.exe' didn't show up in the 'Choose Default Program' …

Member Avatar for thetazva
0
228
Member Avatar for vegaseat

Continued fraction expansion is a simple way to approximate common trigonometry functions to a relatively high precision. In this example we only look at sin and cosine. The results compare well with the results of high precision packages like SymPy. The Python module decimal is used to achieve the high …

Member Avatar for TrustyTony
3
559
Member Avatar for TrustyTony

To be more clear, I post this 'unnecessary optimization' of Vegaseat's code in new thread instead of end of old one. Just to show that this is even simpler than [URL="http://www.daniweb.com/software-development/python/code/363346/1554115#post1554115"]checking if given day is first weekday of the month[/URL].

Member Avatar for TrustyTony
0
1K
Member Avatar for TrustyTony

Little clean up of vegaseat's code for generating pi decimals. Added number of decimals desired and string type return for easy use with ''.join()

Member Avatar for TrustyTony
1
614
Member Avatar for novice20

Hi, I want to do something like this: I have two lists: list1 = range(6) list2 = range(10,15) i want a dictionary like this: adict ={0:10, 1:11, 2:12, 3:13, 4:14, 5:15 } I did the following: [CODE]list1 = range(6) list2 = range(10,15) adict = dict(zip(list1,list2))[/CODE] i get : [B]TypeError: list …

Member Avatar for novice20
0
230
Member Avatar for WolfShield

I would like to make a LUDICROUSLY high number calculator in Python. I am thinking 60 numbers and a decimal point. So numbers could be in a format like these: 60 numbers, 30 numbers decimal point 30 numbers (30nums.30nums), or decimal point 60 numbers (.60nums). E.g. 999,999,999,999,999,999,999,999,999,999.999999999999999999999999999999 But, I am …

Member Avatar for WolfShield
0
316
Member Avatar for WolfShield

Hey guys, I am making a calculator program and don't want the user to type directly into the Entry, so I made the Entry 'readonly'. But that makes it to dark for my liking, so I am trying to set the readonlybackground='white', but it gives me an error saying that …

Member Avatar for WolfShield
0
388
Member Avatar for HiHe

I was trying to create a simple Python GUI with a label on a frame. I can't get the label's position and size to work: [code]# a simple wxPython GUI program # showing a label with color text # however, label position and size do not work! import wx class …

Member Avatar for vegaseat
0
309

The End.