15,181 Topics
| |
Hi!! :) Can someone help me to write a code that with sort through a list of strings which are peoples names without using the python sort function. So the rules are : We start with an initial pile containing only the first name in the list. Go through all … | |
Hi All, I have a list of hex values that originated from a text string that was downloaded having now created a list of thes values approx 804 of them, when i run the list items through a loop to conert hex into dec had an error looking at this … | |
How to run shell commands from python. eg. How to use 'echo $a' commands? where a is any variable. | |
Hello, I am trying to create a program that will allow me to find a certain phrase, (always between brackets and always with a "'0" in it) and replace it. Basically I have something like [ k '0 ir e ] and what I need to do is use regular … | |
We are moving from an Informix DB/Stored Procedures to a Vertica DB/Python environment. I am not sure how to even start since the Vertica DB is new and we have NO training in Python. Here is a basic scenario: I have two tables and one table will update the other … | |
File "/usr/local/lib/python3.2/distutils/archive_util.py", line 52, in make_tarball tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) File "/usr/local/lib/python3.2/tarfile.py", line 1769, in open stream = _Stream(name, filemode, comptype, fileobj, bufsize) File "/usr/local/lib/python3.2/tarfile.py", line 421, in __init__ raise CompressionError("zlib module is not available") tarfile.CompressionError: zlib module is not available garrett@toshiba-laptop ~/Desktop/nester $ I'M getting the above … | |
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 = … | |
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 | |
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 … | |
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 … | |
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: … | |
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 … | |
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 … | |
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. … | |
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? | |
| 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 … |
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, … | |
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, … | |
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 … | |
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 … | |
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 | |
can anyone give simple example of storing data in datastore in google apps engine using python . thnx | |
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 … | |
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, … | |
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 … | |
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), … | |
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 , … | |
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') … | |
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) | |
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 … |
The End.