15,406 Topics

Member Avatar for
Member Avatar for spe_eddy

I am wanting to refer to a number of items from the end of a list, but can't get the syntax right, [CODE]previousDays = 5 pDaysRange = (31-previousDays,32)[/CODE] previousDays is the variable I can change, there are 31 days in the month so i'm trying to take the last 5 …

Member Avatar for spe_eddy
0
145
Member Avatar for blacknred

I'm trying to do some simple parsing as example: [code]import csv import os,sys spamWriter = csv.writer(open('eggs.csv', 'wb'), delimiter=' ',quoting=csv.QUOTE_MINIMAL) string = "cat /home/myfile.txt |grep -m 1 "my game" " string2=os.system(string) spamWriter.writerow([string2]) [/code] [quote]home]# python excel2.py File "excel2.py", line 4 string = "cat /home/myfile.txt |grep -m 1 "my game" "[/quote] ^ …

Member Avatar for TrustyTony
0
164
Member Avatar for scyonto

Hey guys, before I begin, I'd like to specify that this is for a personal project that I am playing with, and not for work or school or anything of that ilk. In Python, I am trying to define a function that will search a .txt file containing a large …

Member Avatar for TrustyTony
0
115
Member Avatar for blacknred

Hi, I'm intend to do the following -do a calculation ; record the value with timestamp to excel (csv format will do) -repeat above step; append a new row to csv with newly calculated value and timestamp. ... ... continue in endless loop. Could someone give me some pointers on …

Member Avatar for richieking
0
83
Member Avatar for leeggodfrey

Hello All, I have a very simple search cursor that is selecting from a table a list of names in order to query a database. It was working fine until I encountered a name with an apostraphe in it. O'Brien for instance. The search cursor is very basic. [CODE] inCur …

Member Avatar for leeggodfrey
0
171
Member Avatar for WolfShield

Hello, I've just recently found out about Python scripting and I am interested in programming an auto login script. However, when looking around, I haven't found any Python web scripting tutorials or guides. If someone could either explain to me how it works, or point me towards a good tutorial …

Member Avatar for WolfShield
0
515
Member Avatar for spe_eddy

Sorry - I know this isn't strictly Python, and i'm more asking for a formula than code! Usually Excel functions show how they are calculated but i can't find anything on this one! So given a set of data, predict what the next value will be based on the previous …

Member Avatar for spe_eddy
0
480
Member Avatar for meensatwork

Hello, Iam using matplotlib to create a scatter plot and i have trouble in converting to exe. The error iam getting is [CODE]Traceback (most recent call last): File "portopti.py", line 8, in <module> File "matplotlib\pyplot.pyc", line 95, in <module> File "matplotlib\backends\__init__.pyc", line 25, in pylab_setup ImportError: No module named backend_tkagg[/CODE] …

Member Avatar for meensatwork
0
531
Member Avatar for meensatwork

I have an issue while creating a CSV file using the CSV module [CODE]csvFp = csv.writer(open(fileName,"w"), delimiter=',') csvFp .writerow('1') csvFp .writerow('2') csvFp .writerow('3')[/CODE] When i execute the above code,it creates the CSV file correctly but a blank line is inserted between each row eventhough i have not inserted that in …

Member Avatar for meensatwork
0
131
Member Avatar for ahappysadface

dear Group256 i am a student who is doing my project on python platform...according to my project i has to have a client server public chat code which is very similar to the one u have posted here. i am currently working on a code for this puepose but i …

Member Avatar for griswolf
0
112
Member Avatar for ywang

[I]<<mod edit: answer to [URL="http://www.daniweb.com/software-development/python/threads/32007/1496502#post1496502"]this post[/URL] from the sticky "[URL="http://www.daniweb.com/software-development/python/threads/32007"]projects for the beginner[/URL]">>[/I] [CODE] #1 * 8 + 1 = 9 #12 * 8 + 2 = 98 #123 * 8 + 3 = 987 #1234 * 8 + 4 = 9876 #12345 * 8 + 5 = 98765 #123456 …

Member Avatar for vegaseat
0
1K
Member Avatar for jworld2

I'm trying to do a project that uses the trigonometric functions, but I'm having some trouble with them. When I type in this code: [CODE]import math print 0.5+math.cos((2*math.pi)/3)[/CODE] I get the answer 2.22044604925e-016. That's obviously not right. cos((2*pi)/3) is -0.5, so I should get the answer 0. Can anybody help …

Member Avatar for jworld2
0
539
Member Avatar for Shansal

Hi All, I created succesfully an executable version (Py2exe, Pyinstaller) of my application. When I try to run the app from .exe, I get an error as follows in the log file: [B][CODE]Traceback (most recent call last): File "CreateAS.pyw", line 8, in <module> ImportError: cannot import name Publisher[/CODE][/B] I am …

0
42
Member Avatar for shawntheking

I have no idea where to start with this Python code. Any help is greatly appreciated. There is obvious going to be an input function but I'm not sure how to make the list. Here is the problem: Write a program to take in the names of U.S. Presidents into …

Member Avatar for griswolf
0
55
Member Avatar for G_S

Hello I'm trying to make a verb conjugator for Spanish. The problem is that I need to get the last two characters in the verb to be able to determine the verb group to which it belongs. In Spanish, conjugation depends on the verb ending, among other factors. Verbs end …

Member Avatar for G_S
0
23K
Member Avatar for linuxoidoz

For example I have a non-ordered list of values [10, 20, 50, 200, 100, 300, 250, 150] I have this code which returns the next greater value: [CODE] def GetNextHighTemp(self, temp, templist): target = int(temp) list = [] for t in templist: if t != "": list.append(int(t)) return str(min((abs(target - …

Member Avatar for linuxoidoz
0
770
Member Avatar for pythonbegin

Hi All Hope everyones doing good. I have two \t files with 3 columns, file1 contains 600050 rows and file2 contains 11221133 rows. I am comparing file2 with file1 to match common entries in first two columns, if file1[0:2] in file2[0:2 ,] write file2[0:2]+column 3 else fil1[0:2] + 5. I …

Member Avatar for griswolf
0
1K
Member Avatar for pink_872

I am trying to read from a txt file and counts the number of times each word appears. The problem is that it counts the EOL characters as well. I tried to use the rstrip, still it didn't do anything. So how can I handle these end-of-line characters? Please help. …

Member Avatar for griswolf
0
174
Member Avatar for magnetpest2k5

Hello, I am looking into the matplotlib module to plot my data. The graph that I am interested is in the following code. Now I want to mention some labels over the each bar plot mentioning some string and values is there any function to do? Also I want to …

Member Avatar for GDICommander
0
216
Member Avatar for andrewtrench

I have a foreign key linking two models. One is called ZumaDirectors, the other ZumaConsolidated. For some reason I cannot access fields on ZumaConsolidated from ZumaDirectors using foreign key. I can do this without a problem on ZumaDirectors with a foreign key linked to another table. I want to be …

Member Avatar for Kruptein
0
160
Member Avatar for HelloPeople1

Hi guys i have 3 question for the pygame pong game I made: 1. I keep getting an error when i run this that has to do iwth the wx window I made for the user to enter a speed. this is the error code: [ICODE] Traceback (most recent call …

0
82
Member Avatar for nightrev

Write a Python function that will take a string of the form “4/11/2010” and print the corresponding date in the form “Apr 11, 2010”. Make use of strings, lists, and appropriate operators/methods. In particular, define a list that contains the month abbreviations so that you can convert without needing any …

Member Avatar for Legnoduro
0
119
Member Avatar for constntine

I am working on a project and coding in Python 3.1 where I need to find a string in a file. I have already considered reading the file to a string and then using rfind() on it, but that does not seem to be efficient, seeing as how I expect …

Member Avatar for snippsat
0
541
Member Avatar for hughesadam_87

Hello all, I've tried to find this problem in past threads, so sorry if this is a repost. I have a large file with regular data. The file is too large for me to open it all at once, so I need to split it into evenly (preferred) spaced output …

Member Avatar for Gribouillis
0
297
Member Avatar for kur3k

hello, i must change size image, when i install PIL i return this error [url]http://www.bankfotek.pl/image/918629.jpeg[/url] I use WIN 64-bit and i have ActivePython So, i can resize image whith wxPython? If i can, how?

Member Avatar for woooee
0
119
Member Avatar for Fo.katia

An acronyum is a word formed by taking the firs letters of the words in a phrase and making a word for them. I need to write a program tha tallows the user to type in a phrase and then outputs the acronyum in uppercase for that phrase. This is …

Member Avatar for griswolf
0
144
Member Avatar for joeywheels

I'm trying to count the length of each word in a string of text and then count the frequency of times that number of characters shows up throughout the entire text. I can't seem to figure out where to go from what I have here. Any help is greatly appreciated. …

Member Avatar for richieking
0
2K
Member Avatar for stefh

Hi! :) As said in the title i try to get (as a string) the parent of a selected item, but i can't manage to do it. Of course i can easily retrieve the string of the selected item with GetItemText... But how do we retrieve its parent? Example: if …

Member Avatar for stefh
0
388
Member Avatar for parijat24

[CODE]I have afile which has entries like BIG_CLUSTER106: cluster1150: CUB CUB CUB BIG_CLUSTER106: cluster1627: CUB Zona_pellucida BIG_CLUSTER106: cluster1632: CUB CUB CUB CUB CUB BIG_CLUSTER106: cluster1814: Kringle WSC CUB BIG_CLUSTER106: cluster2768: CUB CUB F5_F8_type_C F5_F8_type_C MAM DUF3481 BIG_CLUSTER106: cluster661: Astacin CUB CUB CUB CUB BIG_CLUSTER106: cluster687: CUB PDGF BIG_CLUSTER106: cluster701: CUB …

Member Avatar for richieking
0
167
Member Avatar for EMT

Hi, Below is the code I am compiling to a .dll & .lib but when I try to import the "Rand" module I get [B]ImportError: No module named Rand[/B], I renamed the .dll to .pyd then this error is removed but when I call the sub module Rand.myRand(10,30) it crashes …

Member Avatar for EMT
0
194
Member Avatar for spe_eddy

[CODE]testingdays = testingData.getMeasurements() for day in testingdays: dayValues = [] dayValues[0].append(day.tempMean) dayValues[1].append(day.tempMax) dayValues[2].append(day.tempMin) dayValues[3].append(day.dewPoint) dayValues[4].append(day.humidMean) dayValues[5].append(day.humidMax) dayValues[6].append(day.humidMin) dayValues[7].append(day.pressure) dayValues[8].append(day.meanWindSpeed) dayValues[9].append(day.maxWindSpeed) dayValues[10].append(day.maxGustSpeed) dayValues[11].append(day.visibility) [/CODE] this is my code and when i try to run it i get the error message: "Traceback (most recent call last): File "main.py", line 166, in <module> …

Member Avatar for TrustyTony
0
3K
Member Avatar for Archenemie

I've just bought a reasonably capable quad core desktop and I want to start utilizing some of the advantages that multi core processing can offer. I have two simple counting functions, and I would like them to execute simultaneously. Does anyone know where I can start my research into the …

Member Avatar for richieking
0
133
Member Avatar for novice20

using pysnmp I am querying a variable which gives the IP address. I want to check that address. I do the following [CODE] ........... ............ ............. errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( cmdgen.CommunityData('xxx', 'yyy', 1), cmdgen.UdpTransportTarget((addr,161)), ((1,3,6,1,4,1,18489,1,2,2,2,9,30,0))) print"Error on GET for ccmSDIDULinkUtilEastRemoteIP -%s,%s%(errorIndication,errorStatus) print varBinds print varBinds[0][1] [/CODE] i get …

Member Avatar for novice20
0
199
Member Avatar for Emred_Skye

Hi, I was hoping someone could help out a python novice like me. I want to find in my data when there is three or more 1s in a row. This is a sample of what my input data would look like below. With the first number in each column …

Member Avatar for griswolf
0
137
Member Avatar for rssk

hi all ...... import os os.system("ps") i want to kill two particular process i.e, log and snmp .....how to kill it , can anyone can plz help me:) thanks in advance

Member Avatar for Gribouillis
0
116
Member Avatar for kur3k
Member Avatar for viandante

Hello! I am trying to create a tabbed program with Pyqt4. The idea is that I want to be able to add python scripts in a folder. Those scritps should be then be accessible from a main framework/program. Finally, when I run the python script I want the window to …

0
73
Member Avatar for TrustyTony

Not my code but I think free to share. This is intended as beginning point of learning classes or learning data structures. Read the document [url]http://mcsp.wartburg.edu/zelle/python/python-first.html[/url] As first exercise, this does not work instead of the while loop in test part: [CODE] for i in numbers: print i [/CODE] [QUOTE] …

Member Avatar for TrustyTony
0
857
Member Avatar for bob_b

Hi all. This is my first post and i am bit new to python. Pls dont mind if my question is dumb, kindly guide me I am writing a pexpect script (i am using linux Centos 5.5) to access my cisco router and want to record the output of "show …

Member Avatar for griswolf
0
261
Member Avatar for novice20

hi all.. I need to issue a 'ping' to an ip address via my script and check whether it is up? can I issue it using os.system? can I capture the output and analyze to see if the host is up??

Member Avatar for novice20
0
2K
Member Avatar for orangepyth

This code changes anum but it should not?? What is going wrong? Many thanks >>> astr=['a','b','c','d'] >>> anum=[4,3,2,1] >>> anew=anum >>> for c,d in enumerate(anum): ... anew[c]=astr[c] ... print(anew,astr,anum) ... ['a', 3, 2, 1] ['a', 'b', 'c', 'd'] ['a', 3, 2, 1] ['a', 'b', 2, 1] ['a', 'b', 'c', 'd'] …

Member Avatar for orangepyth
0
117
Member Avatar for rustybar

Hi I would like to create a daemon python process in windows which will spawn 8 processes out. Whenever, there is a job, it will be pushed to the queue and the job will be run. If the full 8 processes are been utilised, then the jobs will remain in …

Member Avatar for TrustyTony
0
1K
Member Avatar for wulaishiwo

Hi all, In my current project, I need to write python code extracting tons of pages grabbed from the web. By extraction, I mean strip all tags and comments and if possible, filter out small sections like navigation links. The only thing should be left is the length paragraph, if …

Member Avatar for snippsat
0
241
Member Avatar for kishorerp

am working on creating a python script to find Installed programs in Uninstall folder in registry, the script works perfectly fine on 32 bit machines but errors out with a wmi error on 64 bit machines. Am not able to get hold of a wmi module for python on 64 …

0
160
Member Avatar for bumsfeld

This Python snippet shows you how to take typical beginner's example of prime number function and work on improving its speed. The decorator function for timing is ideal tool to follow your progress you make. The improvements are commented and you are encouraged to make further improvements. Python is fun!

Member Avatar for TrustyTony
0
2K
Member Avatar for kur3k

hello, i want use wx.ScrolledWindow() in wx.Dialog() but i dont now how, i use two, three sizer's and nothing ... my code is to long, i search simple example! i must scroll this dialog -> [url]http://www.bankfotek.pl/image/915282.jpeg[/url] thanks

0
59
Member Avatar for magnetpest2k5

Hello all, suppose I have a string which i have retrieved using the regex like the following [CODE] string_feature = '<div class="BVRRLabel BVRRRatingNormalLabel">Customer Rating</div><div class="BVRRLabel BVRRRatingNormalLabel">Value for Price</div> <div class="BVRRLabel BVRRRatingNormalLabel">Picture Quality</div> <div class="BVRRLabel BVRRRatingNormalLabel">Ease of Use</div> <div class="BVRRLabel BVRRRatingNormalLabel">Features</div>' [/CODE] What will be the regular expression to get the …

Member Avatar for snippsat
0
116
Member Avatar for danholding

continued from this thread! [url]http://www.daniweb.com/software-development/python/threads/353210[/url] i have a file which i am currently working on which will remove all pipes and replace them with a comma. that all works fine it the second bit i am currently stuck on.. i need to remove the first two CAPITAL letters from the …

Member Avatar for danholding
0
146
Member Avatar for danholding

please bare with me as im a returning newbie and have not really used re.expression much and still get very confused! my problem! i am currently working on a few database records which need appending. this is one of the files i need to resort the data base has now …

Member Avatar for TrustyTony
0
428
Member Avatar for Swift2

I'm trying to create two for statements,but only one of them runs >.< it's supposed to obfuscate username AND passwords.. Also is there any way to simplify it rather than have two for statements..? The only difference in the second for statement is "Username" and "username" changed to "Password" and …

Member Avatar for Swift2
0
206

The End.