15,185 Topics

Member Avatar for
Member Avatar for greatman05

Hello. What are some ways that one can work with (x,y) coordinate pairs in Python? I'm doing a homework assignment that requires me to create a program that can check for certain binary relations (reflexive, transitive, symmetric), and I'm having an issue coming up with the best approach for it. …

Member Avatar for greatman05
0
275
Member Avatar for bsh6wc

I have a file that looks like this: 110603/1200 stuff stuff stuff min and max 0.00 1.00 110604/1200 stuff stuff stuff min and max 0.00 1.50 etc... I want to pull out the date and pair it with the associated min and max value associated with it. I know how …

Member Avatar for TrustyTony
0
130
Member Avatar for Niner710

Hi, I am interested in trying to make a cumulative distribution function in Python. I have a set of data in a numpy array and just want to plot that data. numpyArray = [0.4, 0.3, 0.6,1.2,1.8, 0.5] I would also like to have a vertical line on the x-axis at …

Member Avatar for Niner710
0
242
Member Avatar for kernel>panic

I wrote an XML parser that works great to fit my needs, but I can't retrieve the root attribute nodes no matter what I try! So far I have the following code that works great to retrieve the child tag values: import xml.dom.minidom def parse(filename): xmlDoc = xml.dom.minidom.parse(filename) tag = …

0
122
Member Avatar for adrigreat14

I am starting to learn python as my first programming language, but i ran into a problem while trying to make a function that calculated the missing variable in the simple equation v= u+at. The problem is that i am incapable to change a variable's value from False to True …

Member Avatar for adrigreat14
0
280
Member Avatar for Despairy

Hi, Im trying to parse a file which contains some random text. How can i match a case which seperates "garbage" (anything but digit/letter) char?? for e,g: 25.5.5 will produce . (the 2nd dot, because 25.5 is a number (rational)) another e.g: ----3.82 will produce --- (because -3.82 is a …

Member Avatar for nbaztec
0
154
Member Avatar for 4evrmrepylrning

So I have been told by various people on numerous occasions that you cannot parse XML by using regular expressions or any means other than a parser. So, here at work, I have LXML and that is what I have to use. At the moment I am trying to remove …

Member Avatar for 4evrmrepylrning
0
274
Member Avatar for Despairy

lets say i have these two patterns patternWord=r'[a-zA-Z]+' #word patterns patternNum=r'[+-]?\d+\.?\d*' #numbers patterns can i make a third pattern that is made out of them? patternTrhee= NOT patternWord AND NOT patternNUM? so than it will find all others? didnt find how to combine patterns and my teacher doesn't know either …

Member Avatar for TrustyTony
0
145
Member Avatar for pansquare

is there a way in python to only take from a file a string in between certain characters? for example, if i have this in a file: city state[long, lat]population how can i take from the line just what is in between the brackets (that is, come up with [long, …

Member Avatar for nbaztec
0
240
Member Avatar for felix001

When trying to install django tagging Im getting the following error : [root@Fileserver django-tagging]# pwd /opt/django/djangoblog/django-tagging [root@Fileserver django-tagging]# python setup.py install Traceback (most recent call last): File "setup.py", line 49, in ? version_tuple = __import__('tagging').VERSION File "/opt/django/djangoblog/django-tagging/tagging/__init__.py", line 3, in ? from tagging.managers import ModelTaggedItemManager, TagDescriptor File "/opt/django/djangoblog/django-tagging/tagging/managers.py", line 5, …

Member Avatar for TrustyTony
0
185
Member Avatar for Sunciti

I have a nested dictionary which looks like: { A:{I:{key1:value1,key2:value2}, II:{key1:value2, key2:value5, key3:value6}}, B:{I:{key1:value1,key2:value2}, III:{key1:value2, key2:value5, key3:value6} IV:{key1:value9, key2:value7, key3:value8}}, C:{V:{key1:value11,key2:value22}, VI:{key1:value12, key2:value15, key3:value16} VII:{key1:value19, key2:value17, key3:value18}} } My objective is to retrieve the keys ( A,B,C and I,II,III,IV,V,VI,VII) for the occurences of a value. So for example, if I …

Member Avatar for TrustyTony
0
1K
Member Avatar for ihatehippies

I'm trying to create a wx.ListCtrl with a searchable header. I've been looking through the listctrl mixins, but I really don't have the wx expertise needed. I'm thinking I need to paint a textctrl using a dc object, but other than that I'm lost. Any ideas?

0
192
Member Avatar for White Eagle

How would I find all occurances of the letter 'e' for example in a list of the split word elephant? I've tried using letterlist.index('e') for example but index only returns the first occurance of e. This is to be used in a hangman game, and the game needs to display …

Member Avatar for woooee
0
184
Member Avatar for SCass2010

Hi everyone, Just wondering if anyone could help. At the minute I need to check a command line for the parameter "--date=something", I've been using the re module with python like this cmd = "python myapp.py --name=stephen --date=20120323 --test=testthis" found = re.split (r"--date.*", cmd) print found but this prints the …

Member Avatar for TrustyTony
0
182
Member Avatar for felix001

I need to create a simple input form without the use of a DB. Can anyone please assist? Thnaks,

Member Avatar for felix001
0
92
Member Avatar for woooee

When clicking the "Edit" button on an existing post, you are presented with the post and just an "Edit Post" and "Cancel" button at the bottom, neither of which post the edited version. Is there a FAQ for the new methods? If not then there should be. Also posting a …

Member Avatar for TrustyTony
0
255
Member Avatar for braybray

I have a file has the cities names and information such as names, coordinates of the city and population of the city Youngstown, OH[4110,8065]115436 Yankton, SD[4288,9739]12011 966 Yakima, WA[4660,12051]49826 1513 2410 Worcester, MA[4227,7180]161799 2964 1520 604 Wisconsin Dells, WI[4363,8977]2521 1149 1817 481 595 How can I create a function to …

Member Avatar for woooee
0
167
Member Avatar for boiishuvo

I want to make a program that it can create a HTML page. It should be able to make a table (with data provided) using the HTML by the program itself. This code also uses wsgi so when the program runs you will need to type the localhost on a …

Member Avatar for woooee
0
338
Member Avatar for pakiali007

hi, guys I'm completely new with python and right now struggling when it comes to creating functions....i have to do the following for an assignment if anyone can help that'll be awesome. Create a function that take a full name as a parameter and returns just the middle name regardless …

Member Avatar for TrustyTony
0
234
Member Avatar for markusd5454

Below is the question and my attempted answer 5.4 Use the list of module titles from the previous exercise to create a for loop. It should ask the user for every title whether they would like to keep the title or delete it. Delete the titles which the user no …

Member Avatar for Gazzmonkey
0
274
Member Avatar for Gazzmonkey

Hi, this does compile but I only want results that have the same amount of characters as the input! Can anyone shed some light on this as I can't figure it out myself! thanks. import re # opens a .txt file and searches for matching letters in words that are …

Member Avatar for TrustyTony
0
152
Member Avatar for snippsat

Where is sticky treads starting python,Gui programming....? These were very good treads and should be sticky.

Member Avatar for TrustyTony
0
100
Member Avatar for CimmerianX

So, I am a novice with python. I'm trying to teach myself python just to expand my skills. I gave myself a simple challenge and I need some guidance here on how to get it done. The goal is to read in a dhcpd leases file, read through the lease …

Member Avatar for TrustyTony
0
945
Member Avatar for fistfullofbeer

I am working on a personal project and am trying to figure out if Python 3 or PHP would work better. I prefer Python because I am trying to hone my skills at it and at the same time I really do like its syntax and ease to learn. I …

Member Avatar for TrustyTony
0
164
Member Avatar for 4evrmrepylrning

Help needed please. Desperate. I have a 3.somethingGB file that contains records that looks like this: [ICODE]<tag> <number>1</number> <info>blah blah</info> <more>Lorem Ipsum</more> <anothertag>The quick brown fox...</anothertag> <id>32444</id> <yetmore>blah blah</yetmore> </tag> <tag> <number>2</number> <info>qwerty</info> <more>yada yada qwerty</more> <anothertag>yada yada qwerty</anothertag> <id>32344</id> <yetmore>yada yada qwerty</yetmore> </tag> <tag> <number>3</number> <info>yada yada qwerty</info> <more>yada …

Member Avatar for Gribouillis
0
275
Member Avatar for maxwellp

I have written the following code to return True if the list has any repeating elements and False ow [CODE]def has_repeats(L,newlist = None): if newlist == None: newlist = [] if len(L) == 0: return False if L[0] in newlist: return True else: newlist.append(L[0]) has_repeats(L[1:],newlist)[/CODE] It is not returning True …

Member Avatar for TrustyTony
0
160
Member Avatar for zephiechan

I tried searching around, but I don't understand exactly what I'm looking for so it could very well exist already and I just don't know how to ask the search engines about it. I apologize in advance. Thus the question mark on the thread title. My current background of programming: …

Member Avatar for Gribouillis
0
139
Member Avatar for starkles

Hello everyone, I have been working on a python script to help assign university students to workplace placements. The problem is that for a given group of students there are only a limited amount of places and each placement location can only caters for a few students. The ideal solution …

Member Avatar for TrustyTony
0
211
Member Avatar for A_Dubbs

Hello everyone! I am taking a python course at my college and I have recieved a question for my homework that I am having trouble with. [I]14) Write a program that finds the average of a series of numbers entered by the user. As in the previous problem, the program …

Member Avatar for B dawg
0
940
Member Avatar for Sunciti

Hi - I'm a rookie programmer. Could somebody explain how I can append a nested list of the form: List = [[Name1,[Detail-1,Counter-1],[Detail-2,Counter-2].....] [Name2,[Detail-1,Counter-2],[Detail-2,Counter-2].....] ................................................. ] My code is : def program(List, Name, Detail): for entry in List: if entry[0] == Name: entry[1].append([Detail,Counter]) return [B][I] List.append ([Name,[Detail]]) for entry in index: …

Member Avatar for misokolsky
0
8K

The End.