15,175 Topics

Member Avatar for
Member Avatar for cjquines

Hello, new to python a bit. I get an indentation error at line 10, "m -= 1". Sorry if this is a repeated post, I've tried searching but found no solution. # calculates sum of squares of natural numbers print "Enter number of terms." n = raw.input("Terms? ") first_term = …

Member Avatar for want_learn
0
106
Member Avatar for vimalya

ihave a file containing data in the form of table with 5 columns and 10 rows the columns are separated by spaces . i have a to read the file line by line without reading the first line which is the header line.Please suggest me the code using python technology

Member Avatar for vimalya
0
160
Member Avatar for vegaseat

The Tkinter library folder \lib-tk contains a module called turtle. You can import this module and experiment with turtle graphics. Tell the turtle to move and draw circles, lines, rectangles and more, and watch it, as it performs on a Tkinter canvas. In typical turtle fashion it moves at its …

Member Avatar for woooee
0
2K
Member Avatar for maiden128

Hello, I'm new and I was wondering how to do these things in python using turtle graphics... but don't know how to do it: 1.Write a program that draws a red line connecting two points (-39,48) and (50, -50) and displays the coordinates of the two points. 2. How to …

Member Avatar for woooee
0
225
Member Avatar for bverhaar

I have to make my own turtle class without using the "from turtle import *" line. This is the code i have so far: from graphics import * class Turtle: '''The turtle''' def __init__(self, win, defstep, defwidth, defangle, startpt, startangle): '''initialize the turtle - win: window to draw - defstep: …

Member Avatar for TrustyTony
0
188
Member Avatar for Thomasmcdaniel

This script is suppost to autorun from the flash drive once it is inserted into the pc it needs to auto download files to a paticular folder called (MEDIA) And it is supposed to over write whatever is in the (MEDIA) folder and add the new content from the flash …

-1
63
Member Avatar for pxalpine

I have two files, "ranked.txt" and "sorted.txt". Sorted.txt is a smaller subset from ranked.txt that is sorted in alpha order. However ranked.txt preserves the ranking of words I would like to keep. How do I check the rank of every word in sorted.txt when matched to the original ranked.txt? I …

Member Avatar for woooee
0
194
Member Avatar for dan.nitschke

Hello, I am trying to make a variable (name) so it only accepts alphabet characters (eg. DaNiEl) not $@@4234. Below is an example of the code i'm trying to use. I have tried a few functions, to no avail. Can someone please post the answer (in code form). Much Appreciated. …

Member Avatar for vegaseat
0
5K
Member Avatar for Lardmeister

To print on the same line Python2 uses print item, Python3 uses print(item, end=' ') Is there a way to make it work in both versions?

Member Avatar for Ene Uran
0
241
Member Avatar for Doormail11

I am completely new at Python and I am not sure where to start with this task. Basically, I want to search for a word in each line; if the word is there, output the entire line to another file (Excel or Text). The lines look like this: PA,IAV protein,AC0T9,DHP …

Member Avatar for TrustyTony
0
201
Member Avatar for ProNewb

I need a little bit of help here with comparing data sets. file1 = open("filename1.txt", "r") file2 = open("filename2.txt", "r") fileone = file1.readlines() filetwo = file2.readlines() file1 = close() file2 = close() exfile = open("results.txt", "w") for line1 in fileone: s1, v1, p1 = line[:-1].split(":") for line2 in filetwo: s2, …

Member Avatar for TrustyTony
0
158
Member Avatar for hughesadam_87

Hi, I'm having some difficulty reading in boolean values from a file, particularly false values. Python can understand false values as empty strings, as well as a few other ways. For example: In [43]: bool(0) Out[43]: False In [44]: bool(False) Out[44]: False In [45]: bool('') Out[45]: False The problem is, …

Member Avatar for woooee
0
894
Member Avatar for D33wakar

This is a simple hangman game that I wrote using my beginner python skills. Though this game is playable, there must be lots of things I must've been doing wrong or the methods I'm using here may be not so pythonic. So I want some suggestions on how to improve …

Member Avatar for TrustyTony
1
709
Member Avatar for padton

Hello all, this is my first post here. I seem to have a problem dealing with data, csvs and dictionaries. Here is a snippet of contents of file 1 (Node,x,y,z): 1,19.0,18.2,22.4 2,8.4,9.4,10.2 4,22.2,2.5,3.1 7,3.2,6.1,4.3 10,3.1,4.2,33.7 11,3.7,23.8,23.4 Here is a snippet contents of file 2 (Node,x,y,z): 1,4.2,7.3,9.5 2,4.1,8.4,9.2 4,2.3,4.6,3.2 11,2.5,2.7,32.6 File …

Member Avatar for woooee
0
161
Member Avatar for Jacklittle01

Hello. I am new to python and am making a text-based game. If you want to be a code editor supply your email in the comments. You will get your share of revenue*. *Provided there is revenue

Member Avatar for extr3mex
-3
74
Member Avatar for nishu..

can anyone give simple example of storing data in datastore in google apps engine using python . thnx

Member Avatar for hughesadam_87
0
175
Member Avatar for hughesadam_87

Hi, I am trying to create the most general function possible to test if an object passed into it has mutability or not. With some prior help from pytony, it seemed that the best way to do this is to try to set and attribute. If the attribute can be …

Member Avatar for hughesadam_87
0
4K
Member Avatar for floatingshed

This is probably going to be beyond my knowledge/experience but I thought I'd ask... I work on a radio station in the UK. I have a friend in Canada who wants to listen but he is 5 hours behind us. I'd like to be able to capture our shoutcast stream, …

0
62
Member Avatar for Tortura

Hi, I want to execute a tcl command with a python method. I don't really know how this works. This is my tcl command: <object> config -<parameter> Now I want a python method, that should look like this: def config(config_obj, parameter): #code which executes the tcl command Do you know …

Member Avatar for Tortura
0
4K
Member Avatar for dan.nitschke

Hello, I am doing a school project and need assistance on validating raw input, this is very simple stuff, but can someone answer this for me? The statement is: ordertype = str(input("Is the order pickup or delivery?")) Only two values could be entered: P or D (or p or d), …

Member Avatar for M.S.
0
137
Member Avatar for ceck30s

I have a text file that contains something like this: # Comment # Comment # Comment # Comment # Comment Comment # Comment #Raw SIFs at Crack Propagation Step: 0 # Vertex, X, Y, Z, K_I, K_II, K_III, 0 , 2.100000e+00 , 2.000000e+00 , -1.000000e-04 , 0.000000e+00 , 0.000000e+00 , …

Member Avatar for hughesadam_87
0
333
Member Avatar for python1956

I am trying to sort by key, but it's not working because I don't think that the thing that I'm trying to sort on counts as a list (in fact I think it is an ndarray?): y = np.genfromtxt("1400list.txt", dtype=[('filename','S20'),('freq','S20')]) gives me y as something in the form: [('a070918_215953.SFTC', '1369.000') …

Member Avatar for Lardmeister
0
4K
Member Avatar for Frensi

I'm trying to open a txt file in python, but I'm having trouble. It seems to be working, but I cannot get the text anywhere. Here is the code, does anyone know how I can get the text from the hello.txt file? f = open("c:/users/verzo/desktop/hello.txt") print(f)

Member Avatar for vegaseat
0
124
Member Avatar for ccandillo

I am new to flask and new to git so hopefully someone can help me. This is my git repo: https://github.com/ccandillo/ma-inventory.git I am trying to create a web based spreadsheet. I am storing my data in a sqlite3 database. On my edit page, I would like to be able to …

0
82
Member Avatar for rexmorgan

I could reallly use some help. I am a complete newbie in python. What I would like to do is import a csv file (originally an excel file). Have the user pick a beginning month and an ending month and add the columns of the months between. For example I …

Member Avatar for rexmorgan
0
1K
Member Avatar for rexmorgan

This is working code. You will of course have to replace the directories used in this code with your own that will be unique to your particular situation. You also must have ArcGIS, and the newest version is 10 which will only work with python 2.6. There is plenty of …

0
344
Member Avatar for keyoh

I'm working on a cleanup script for tv shows that I download. Right now I'm just looking for a file greater than 50mb, but there should be a better way. [CODE] import os import shutil dir = "C:\Users\Bobe\Downloads\TV\\" for folder in os.listdir(dir): if os.path.isdir(os.path.join(dir,folder)): for file in os.listdir(dir + folder): …

Member Avatar for The Geek Scope
0
5K
Member Avatar for wootburgers

numbers = [] line = int(raw_input('Enter number: ')) while line != '': numbers.append(line) line = raw_input('Enter number: ') print "Size:" + " " + str(len(numbers)) Hey guys, once again I need some help with a challege. http://pokit.org/get/img/c00a1897d52de5b36329564861fadb1b.jpg For your homework, you are given a set of integer data readings, and …

Member Avatar for TrustyTony
0
260
Member Avatar for wootburgers

I want to make a program that cross checks strings. Here is an example : **Enter line: AAGGAA This sequence can make a hairpin** **Enter line: UGAG This sequence cannot make a hairpin** **Enter line: GUGCCACGGCACCGUG This sequence can make a hairpin** **Enter line: GUACCACGGCACCGUG This sequence cannot make a …

Member Avatar for wootburgers
0
258
Member Avatar for kuchi

xmlrpclib api throwing an error <ProtocolError for host:port/: 500 Internal error> when calling api with the data (contains non-ascii characters), after replaced that non-ascii characters its working. What would be the problem ? what is the resolutions on this?

0
51

The End.