- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 6
- Posts with Upvotes
- 5
- Upvoting Members
- 5
- Downvotes Received
- 5
- Posts with Downvotes
- 4
- Downvoting Members
- 2
39 Posted Topics
I am trying to solve a simple problem. But I am stuck by a simple problem I am confused by "context" in c#. So for this simple problem I am solving Euler problem 1. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; using System.Timers; namespace Euler … | |
Hi What would be a good recommendation for a practical resources on using xml, xpath and xquery? By practical I mean. Accessing values, storing files, creating set queries on xml to create a feed to push data to other applications (eg ipython, rstudio, the Web) maintaining data integrity, and transformng … | |
This is a simple problem that for some reason I can't get to work. The problem I created for myself was to use call a function from a function using *args and print out the question and solution. I want the output to vary as the *args can accept any … | |
Re: There is a stack in the sticky at the top of the forum [Projects for the Beginner](http://www.daniweb.com/software-development/python/threads/32007/projects-for-the-beginner) | |
Re: I agree with vim thats what I am using though I am having a bit of trouble with debugging in vim(vdebug not working for me). Otherwise its great you can get away with just one plugin at the start https://github.com/klen/python-mode and use VAM for managing plugins use the recommended setup … | |
I am doing ex4 from the fundamentals of C#. But I cannot solve the problem. I am unable to slice the array correctly and instead just endup with System.int32[] Simply all I am supposed to do is find the maxmimal sequence of equal consecutive elements. I am trying to follow … | |
Just looking for a push in the right direction. I am overwhelmed by the choice with python at the moment. What are the best tools for managing consitent ETL operations with data in XML and CSV formats to database, graphs and in future a web app. for example should I … ![]() | |
Re: use split in a loop on "_" for letter in file.split("_"): if letter[2] == 'B': do_something elif letter[2] == 'P': do_something else: something_else | |
Re: Its not python but try [Discourse](http://www.discourse.org/) | |
Re: This is if the first letter of the filename is the indicator otherwise regex required. import os def fileCheck(pathname): countB = 0 countH = 0 for file in os.listdir(pathname): if file[0] == 'B': countB += 1 elif file[0] == 'H': countH += 1 else: pass return countB, countH | |
I am having an error file object when opening and reading a text file(csv). I must be misusing the with so that when I call the function race table its getting a file object and not a readline. How can I get the with to correctly hand over the file? … | |
What I am trying to acheive is to parse an xml file break it up into useful components and push it to a multi table SQL database. But I cannot get off the ground in the basics. Take an xml file like this [Click Here](http://old.racingnsw.com.au/Site/_content/racebooks/20140513HAWK0.xml) Which at the start is … | |
What is the best way to implement a reusable usr confirmation? Basically so that I can embed it in other functions, so that the user will get to confirm if output is ok or whether they want to recall function or quit. So it seems it should be like. def … | |
What I am trying to do is delete the key value pairs out of a dictionary if the value is = 0. I seem not to be acheiving that so far. Python 2.7.5+ (default, Sep 19 2013, 13:48:49) [GCC 4.8.1] on linux2 Type "help", "copyright", "credits" or "license" for more … | |
Maybe a list comprehsnion is not the right way to go here. I want to define a nested list that a user can tell how many lists and how many entries in each subllist. Then have random call a value for each entry in the sublist, working on unique entries … | |
Hi I am struggling with assigning values to a list of a list. This is my full code. import random #get user input as to size of range range_size = 0 if range_size == 0: try: range_size = int(input('Size of Range?: ')) except ValueError: print('That was not an integer!') range_size … | |
Re: theword = 'hi' wordlist = ['e', 'i', 'o', 's'] def word(n): result = [] for i in tuple(theword): if i in wordlist: result.append(i) else: result.append('_') a = ''.join(result) return a print(word(wordlist)) From that I get sayth@linux-g8u9:~/dev> python guess.py _i | |
![]() | Re: I feel I may totally misunderstand your question. However, if I do understand it I would first create a list of all the files in the directory you intend to run. files = os.listdir() then go to the files in the created directory. Use try except to test and if … |
Having trouble getting pyhon to repeat things for me. What I wanted to test was python's random.sample. So say I have a list myList = range(1, 15) I can for a single time do this import random >>> myList = range(1,15) >>> random.sample(myList, 3) [10, 6, 11] >>> I would … | |
Hi I am looking some advice on which Java tools to use and /or any hints you can offer a new Java user regarding XML. What I want to do is take an xml file read it, modify it and push it to a database so that it can update … | |
Hi I was doing an exercise in the Real Python book. It gave a task of simulating a coin toss "I keep flipping a fair coin until I've seen it land on both heads and tails at least once each – in other words, after I flip the coin the … | |
I was reading this article [Click Here](http://maxburstein.com/blog/python-shortcuts-for-the-python-beginner/) http://maxburstein.com/blog/python-shortcuts-for-the-python-beginner/ In there was this example from itertools import combinations teams = ["Packers", "49ers", "Ravens", "Patriots"] for game in combinations(teams, 2): print game >>> ('Packers', '49ers') >>> ('Packers', 'Ravens') >>> ('Packers', 'Patriots') >>> ('49ers', 'Ravens') >>> ('49ers', 'Patriots') >>> ('Ravens', 'Patriots') So I … | |
I am reading the book for web2py. It is running through some python syntax examples. When I ge to this closure example I am not understanding how 'y' gets its value. This is the code. >>> def f(x): def g(y): return x * y return g >>> doubler = f(2) … | |
Is there a good portable environment I can use to put on a USB so I can learn wherever I go. So that I have a basic editor and environment to view results. I do plan to use it at work so as self contained as possible. | |
How do I use glob with urllib2? So what I have been trying to acheive with no success is creating a list of file names with glob from two sources and comparing them and download file if it doesn't exist. I can't get past the start because I am not … | |
Say I have a basic list. [CODE]x = [2,3,1,3,5,4,5] [/CODE] And I want to find the sum result applied against the list without duplicates. So with duplicates the code could be. [CODE][elem * 2 for elem in x if elem >= 1 ] > [2, 4, 6, 6, 8, 10] … | |
Can I ask for a little help with virtualenv. I am looking at the docs here [URL="http://guide.python-distribute.org/pip.html"]http://guide.python-distribute.org/pip.html[/URL] and here [URL="http://www.jython.org/jythonbook/en/1.0/appendixA.html#virtualenv"]http://www.jython.org/jythonbook/en/1.0/appendixA.html#virtualenv[/URL] There are a few things I can't quite understand about it. First just to clarify I am on ubuntu and my default python is 2.7.1 1. I use virtualenv to … | |
Is there a way to do nested list comprehension? for example I can square a range of numbers, even only. [CODE][x*x for x in range(1,20) if x % 2==0][/CODE] but what if I want to square the even and times the odd by 3. [CODE][x*x for x in range(1,20) if … | |
Re: [QUOTE=evstevemd;1594828]Mh! When was your last time to play with Linux? Which Distro did you fiddle around with? With Ubuntu (at least starting from version 10.04) and Fedora (From version 12, at least) they just work! Anyway that is kind of myth even my friends had. They didn't even knew that … | |
I want to compare a list of files with extension .rtf in my directory with a list of files at a given url and download the files at the url not found in my directory. This is where I am at but cannot figure how to filter a list based … | |
I started writing a python script to rename files. I wanted it to be able to rename multiple files in a given directory. I started off trying to use rename but then found other options Can't quite get it to happen. Hope my code is understandable, can anyone assist in … | |
Hi I was reading the thread [URL="http://www.daniweb.com/forums/thread12326.html"]http://www.daniweb.com/forums/thread12326.html[/URL] which is about getting user input from a user in python. So I thought I would write something to tst it since I haven't used python in a while so I wrote a basic program to calculate netpay. [CODE]hours = raw_input("Enter Hours Worked: … | |
Re: [URL="http://www.daniweb.com/forums/post1008107.html"]http://www.daniweb.com/forums/post1008107.html[/URL] I found a thread on the forum that possibly covers what you are looking for. | |
I am looking at a project that will import and modify an XML file and then export it to a table. Currently a flat file table system should be fine. I want to export the modified data to the table and then perform a handful of maths(largely simple statistical functions) … | |
Re: [URL="http://www.ibm.com/developerworks/opensource/library/os-python6/"]http://www.ibm.com/developerworks/opensource/library/os-python6/[/URL] Hope this helps | |
![]() | Re: [QUOTE=DEATHMASTER;1003628]I'm just wondering how I would fix this [code]app = first[0:8] and second[0:8][/code] That doesn't work but if I remove "and..." it does but I need both.[/QUOTE] can you do f = first[0:8] s = second[0:8] apps = f+s or whatever comination you require it for |
Hi I am continuing on with one of my first projects in python. This module for my larger project will be to download files(legal freely published by sporting assosciations). I am not sure if my concepts are right in how best to execute this, I have read the urllib docs … | |
Hi I want to prompt the user to enter the date dd/mm/year and use this later as part of filename and later as object in file(if this helps searching). Does using datetime ensure that user input will be a valid input? I would like the output to be year-mm-dd My … | |
HI I would appreciate some assistance if possible. I am embarking on setting up a database for sports data and results( at home project). Wanting to know which application would be most suitable. Data would consist of 60% text(venues dates etc) 40% data(times scores resuts etc). Most of the data … |
The End.