15,181 Topics
| |
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 … | |
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 … | |
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 … | |
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 … | |
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, … | |
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, … | |
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 … | |
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? | |
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 … | |
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 … | |
I need to create a simple input form without the use of a DB. Can anyone please assist? Thnaks, | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
Where is sticky treads starting python,Gui programming....? These were very good treads and should be sticky. | |
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 … | |
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 … | |
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 … | |
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 … | |
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: … | |
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 … | |
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 … | |
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: … | |
I don't know which langauge code it is written(but i think it is python) but i am just posting to know what can happen by the following code snippet. Here is the code:- # # ms12-020 "chinese shit" PoC # # tested on winsp3 spanish, from localhost # # import … | |
Hi all, my Professor has asked us to solve this problem, which is a Midterm Practice problem for our up and coming Midterm exam, which is on Monday. I am wondering if I'm doing this the correct way or not. [B][U]Here is this question the problem asks:[/U][/B] Problem 19 Random … | |
I have made a cipher substitution program which would take some input and print a coded output. however,the required output is not coming. My program first asks for input.then it converts it into a list as it is mutable.ALso,a string of all the alphabets is declared too. [CODE] #cipher code … | |
I have to write a program that will print the chain of a number using a hailstone function, as well as with a range of numbers. That part of my program works perfectly but I cant figure out how to write a function that will find and hold the number … |
The End.