15,175 Topics
| |
File problem 1. Write a function named stringsToFile() that opens a file for writing and writes a list of strings to the file, with each element of the list written to a line. Hint: use a for loop to iterate over the list of strings and write them to the … | |
Hello, long time lurker first time poster. I was looking for some help on a problem I came across on a python site. I am supposed to count the number of times 'code' apears in my string. But any letter can be in the place of the 'd' in 'code'; … | |
So I'm just learning python still, and I've got this assignment to make a maze program (no graphics or any of that, just a text based one) and I'm trying to get it working, but the function I've written to find the legal moves keeps throwing errors. The most recent … | |
Write a program that accepts a filename as a command-line parameter. The program will search the given file for each letter in the alphabet and print statistics on the number of occurrences. I was wondering if i could have some help with this as i dont understand how to do … | |
I am running into some issue with scraping data. If I hardcode value for key "lbo race" in the code below it is able to scrape the data but if I try to set key "lbo race" to a variable which is being read in it doesn't seem to scrape … | |
Hey everyone, Last semester my buddy and I made a tutorial on application programming in Python. This video uses the Enthought Tool Suite (ETS), a free powerful Python development toolkit, to build quick, easy and powerful GUI's. I see many posts on this site about Tk, wx, qt but haven't … | |
I am having trouble trying to figure out how to write code so the room number increases by 1 each time it asks for length and width. Here's what the assignment is about.. In this program, you are going to calculate the total square footage of a five room apartment. … | |
**So i am having trouble with printing as you have noticed with the title** **i need to have 2 things print after the 2 menu choices. it is a smiley face creator** `Inline Code Example Here import time def eyes_menu(): print "These are your choices for eyes:" time.sleep(1) print " … | |
Hi to all, i'm writing a little interface in python with Tkinter on linux debian, with this interface i need to execute some program like rdesktop and vnc. but i've a little problem: i use a fullscreen window without decorator (read buttons for iconify and close) where i've putted some … | |
I want some help to generate a report in PDF/Doc(MS Word) format . I’m not able to find any module to generated report in doc, except “docx” which I’m not able to comprehend. Actually my actual task is to generate the report in Doc only, but as I’m not able … | |
I want to call 'n' which is the input number followed by a string. I've been putting it like this: (n 'string') but it is wrong. How do I write it? | |
Hi I'm new to python and this forum and I am trying to work on a program that splits the html text file into its components: The HTML file looks something like this: " Hello World #title Today is a Friday. The weekend is coming. Lets have fun. #summary 1923 … | |
Hi there again, I'm still a newby in Python, so I'm taking the Google Python Class. They talk about `ls -l` and `rm -rf` (with the last command the class started laughing) But I don't understand it. I googled it and a hint came to me, that is is a … | |
Hi all, I apologise in advance if this is too simple, but I've been searching around for a good hour or two now, and I can't quite get my head around this. Basically, I'm looking to teach myself Python (3), and one of the things I'm trying to do is … | |
Hi I dont really sure what I did wrong but it no working. I am making Snakes and Ladders game with out using list import random separator = '-' * 20 spaces = [None] * 90 c_l_spaces = {r'slid down a chute ': [[14, 3], [20, 15], [39, 33],[66, 53],[69, … | |
Suppose i have a list l=[1,2,3] i want to make this list as [2,3,4] i.e. add 1 to all the values in list l. I want to do it by the method of for loop.. Can someone help? | |
Been stumped over this for a while.. I was just wondering how I'd go about creating pattern movement and randomising it. The movemnt itself is just simple back and forward. But I wanted to make it random rather then fixed (which is what it is now) The main isn't posted … | |
Im trying to teach myself a little bit of python and have become stuck/frustrated. Im on [Python.org](http://www.learnpython.org/page/Loops#) and so far have had no luck. First, the objective is not too clear "Loop through and print out all even numbers from the numbers list in the same order they are received, … | |
I've been trying to finish up an otherwise straightforward assignment for my python comp sci class but for whatever reason everytime I try importing cTurtle it informs me that such a module does not exist. I'm a little confused because I've never had this problem before. The relevent bit of … | |
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. … | |
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 … | |
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 … | |
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 = … | |
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, … |
The End.