15,406 Topics

Member Avatar for
Member Avatar for mahesh.venkateshwaran

I am writing an application that requires to ssh and telnet to a device at the same time. The pseudo code goes something like this. p1 = pexpect.spawn("ssh to the device") p1.send("run some command") p1.expect("..") p2 = pexpect.spawn("telnet to same device") p2.send("run a command that can be run only through …

0
54
Member Avatar for mrpython1

Im thinking about making a little system for an imaginary retailer, Im going to have a section for the employers and there sales figures, Was just wondering If there was something like an import function for graphs? Im a bit of a noob so go easy

Member Avatar for vegaseat
0
535
Member Avatar for Jacklittle01

I am developing a text based rpg, but do not know how to go to different def statement, but it says it is not defined. Help?

Member Avatar for Jacklittle01
0
137
Member Avatar for Mclovin

I'm struggeling with a problem which probably is farely easy to solve. I just cant find a simple way to do it. I want to be able to recognize the occurance of digits in a string. Lets say the string looks like: [CODE] file_Name1 = 'abc123de' file_Name2 = 'qwe987rty' [/CODE] …

Member Avatar for Lucaci Andrew
0
2K
Member Avatar for sugarzzzz

def verifyNeighbor (boardWidth, boardHeight, neighbor, me): my_row=me/boardWidth neighbor_row=neighbor/boardWidth if my_row==neighbor_row and abs(me-neighbor)==1: result=True else: result=False my_column=me/boardHeight neighbor_column=neighbor/boardHeight my_column=neighbor_column if my_column==neighbor_column and abs(me-neighbor)==boardHeight: result=True else: result=False x=boardWidth*boardHeight if neighbor>x: result=False else: result=True if neighbor<0: result=False else: result=True return result given a board of height like 4,5 etc and a width of …

Member Avatar for lancevo3
0
228
Member Avatar for mrpython1

Im trying to create a booking system for a cinema, What i want to do is : open my csv with available seats, print it then ask the user what seat it wants, then the csv need to update taking away the seat, and then that seat gets added to …

Member Avatar for longtomjr
0
4K
Member Avatar for dp121307

So I made the login program that reads the usernames and password from a file (names.txt). The program works correctly. But my problem is I want to ask give the user 3 chances to get the username right before the program closes and 10 chances to get the password right …

Member Avatar for dp121307
0
204
Member Avatar for Octet

Hello Daniweb, I'm beginning to learn Python, which I hope shall be a useful tool to help with server administration and the such. I am however having some problems, I'm sure this is a very simple problem but I can't see what is going wrong. #!/usr/bin/env python3.3 validSelection = 0 …

Member Avatar for Octet
0
210
Member Avatar for vegaseat

A simple code example to calculate the monthly payment on a mortgage loan. Takes a look at Python's newer print and format functions.

4
9K
Member Avatar for krystosan

Can anyone please suggest me best practice to create a Custom widget using QtDesigner? I want to see how to approach adding Qpushbutton or QCheckboxGroup inside the cells of QTable Widgets that will be added on user clicking add new row to QTable at runtime

Member Avatar for vegaseat
0
149
Member Avatar for ichi0915

I want to add a total paid variable to my code, but i couldnt think of any formula to sum the minimum payments and give me a total, my code is program to calculate the credit card balance after one year if a person only pays the minimum monthly payment …

Member Avatar for TrustyTony
0
168
Member Avatar for anton.yakushin

I am wondering if anyone could recommend the best CMS for an Airbnb-style marketplace that allows people to sublet their apartments, and other people to search, filter, and pay for the apartments listed. These are the main requirements: - Ability to sign up both buyers and sellers. - Accounts for …

Member Avatar for LastMitch
0
244
Member Avatar for omer.tzuk

Hello, I am new to Python and have a mission impossible to a beginner, I need to import a specific table from a source code written in LaTex. I tried to start this code in this way : import asciitable from sys import argv def searching_table(table_identifier): with open(fname, "r") as …

Member Avatar for TrustyTony
0
216
Member Avatar for bumsfeld

This shows the code for one simple crypt of text by swapping two adjoining characters each. You can make that more complex if you like. Can also be used for one nice riddle.

Member Avatar for bumsfeld
2
630
Member Avatar for Gribouillis

This snippet defines a Print function which can be used with python 2.4, 2.5, 2.6 and 3.0 (for 3.0 this is just the built-in print function). It's interface is that of the python 3.0's print. It simplifies the task of writing transitional code which runs under python 2.5 and python …

Member Avatar for Lucaci Andrew
1
824
Member Avatar for superbhimanshu

Hi all, I have a list of dates (in MM-DD-YYYY format). I want to sort the list by months ignoring day an year and look the frequency plot by months that is how many dates correspond to January, February and so on. Please Help me ! thanks Himanshu

Member Avatar for TrustyTony
0
75
Member Avatar for vegaseat
Member Avatar for HiHe
3
642
Member Avatar for Fernando_1

# VARIABLE DEFINITIONS name="" adress="" city="" state="" zipcode="" course1="" course2="" course3="" course4="" course5="" #----------------------------------------------------------------------- # CONSTANT DEFINITIONS courses= "Enter courses name (Type 'STOP' when finished) :" pointsR = "\tEnter points received ( Type '9999' when finished) :" pointsP = "\tEnter points possible for this assignment :" #----------------------------------------------------------------------- # FUNCTION DEFINITIONS …

Member Avatar for woooee
0
179
Member Avatar for longtomjr

Ok this is a suggestion... If someone post here in the python forum the must have a tickbox to choose what version of python they use... This will make it esier to see if you'll be able to help Kind regards Longtomjr

Member Avatar for longtomjr
0
181
Member Avatar for amweasel

I have been trying to make a simple "quiz" program on Python. And this is what I coded: print("Mathematics Quiz") question1 = "Who is president of USA?" options1 = "a. Bharat Chauhan\nb. His dad\nc. His mom\nd. Barack Obama\n" print(question1) print(options1) while True: response = input("Hit 'a', 'b', 'c' or 'd' …

Member Avatar for amweasel
0
469
Member Avatar for TrustyTony

Here is my celebration post for entering level 3 in Project Euler. Again I left in my debug prints. I am in process of adapting myself to new .format style of formatting. I have commented out the prints though to get visible the running time of the functions own action. …

Member Avatar for TrustyTony
0
706
Member Avatar for dp121307

I have to make a login program where the username and password are taken from an existing file. I have successfully, in my opinion, opened, read, and brought out all the user names and passwords from the file. The problem is, the user is only allowed to input an incorrect …

Member Avatar for woooee
0
2K
Member Avatar for HiHe

Explore the Python module bisect to search a sorted list and insert elements in the proper location in a sorted list.

Member Avatar for TrustyTony
3
636
Member Avatar for krystosan

I recently made an appication that utilizes pyqt , i could say i wrote the code pythonic and made everything work work as I wanted, but didnt used any data model , so later I realized I could have used data model since I am building list in the QListView …

Member Avatar for krystosan
0
235
Member Avatar for rexmorgan

Good Day, I have a text file in the .csv format. The file originates as a xlsx (excel) file type. The file looks something like the following. Name Number Lat Long Jan Feb Mar Apr Brockton 24-1670-06 38.145236 145.854921 0.15 0.62 1.25 2.14 Westby 24-7432-04 35.846125 132.743652 0.25 0.94 1.14 …

Member Avatar for rexmorgan
0
3K
Member Avatar for MartinPB

Hi all I have a large folder containing multiple xlsx (only one sheet) files which I need to convert to a csv format. I can convert them individually using the [xlsx2csv](https://github.com/dilshod/xlsx2csv) but I cannot make a working function that loops over all the files in the folder and saves them …

Member Avatar for TrustyTony
0
1K
Member Avatar for lancevo3

I have to be missing something obvious here right? I ran test on all the variables and everything looked like it was correct when i > val the loop kept running. Any suggestions? Thanks x = raw_input(":") def whileloop(val): i = 0 numbers = [] while i < val: print …

Member Avatar for lancevo3
0
147
Member Avatar for krystosan

I have made an standalone app inheriting from base class `QtGui.QFrame`, and now i want to add a floating toolbar to it the way I could have in QMainWindow, how should I do it ?

Member Avatar for vegaseat
0
124
Member Avatar for krystosan

this gives syntax error, why would it give ? `[index, each for index,each in enumerate(names)]`

Member Avatar for vegaseat
0
202
Member Avatar for toldav

Hi, Everyone if any one can help me guide me to move sh script to python. thanks. #!/bin/bash DATE=$(date +"%m_%d_%Y"); turn_off_services() { echo -e "\n## Remove unnecessary services" ## Turn off unnecessary services ## chkconfig --list |egrep -i "iptables|smartd|kudzu|bluetooth|rpcgssd" chkconfig iptables off chkconfig smartd off chkconfig kudzu off chkconfig bluetooth …

Member Avatar for TrustyTony
0
114
Member Avatar for halien

Hi, I have a Python script that calls a program that only prints to the terminal [yes I tried to force it to print to file ... no luck]. However, I need to save the output of the terminal to file in order to perform further analysis. In the code …

Member Avatar for vegaseat
0
1K
Member Avatar for aVar++

hello, I think it is just a silly thing but i can't work out why im only getting one number back from this..? def MakeList(n): # Returns a list of n random numbers List = [] for i in range(0, n): List.append(random.randint(0,1000)) return (List) MakeList(10) I get: [546] But if …

Member Avatar for vegaseat
0
420
Member Avatar for vegaseat

A short code to show you how you can download and display an image from the internet on Python's Tkinter GUI toolkit.

3
330
Member Avatar for gerswin

I have two text files containing multiple lines of text, I need to compare both files and write the missing lines in the file two. i will use a while loop for check every 60 seconds, i an idea but just work 1 pass File one: 2012-10-04 01:03:11,50EF87C3.req,192.168.1.1,12312312312,OK -- HUAWEI …

Member Avatar for vegaseat
0
305
Member Avatar for kadowling

I'm wanting to create a while loop that asks the user if he wants to run the program or not... very basic... I know. I was wanting the prompt to ask the user to input "Y" or "y" to have the program run. Like this: programStart = str(input("Please press 'y' …

Member Avatar for vegaseat
0
243
Member Avatar for glez_b

#! /usr/bin/python import numpy as np data = np.loadtxt('path-tracks.csv',dtype=np.str,delimiter=',',skiprows=1) print data [['19.70' '-95.20' '2/5/04 6:45 AM' '1' '-38' 'CCM'] ['19.70' '-94.70' '2/5/04 7:45 AM' '1' '-48' 'CCM'] ['19.30' '-93.90' '2/5/04 8:45 AM' '1' '-60' 'CCM'] ['19.00' '-93.50' '2/5/04 9:45 AM' '1' '-58' 'CCM'] ['19.00' '-92.80' '2/5/04 10:45 AM' '1' '-50' …

Member Avatar for glez_b
0
4K
Member Avatar for farhan69

Hi , I am new to python coding . I have a Strace output file and i need to extract two columns. The sample Strace file i have attached here i would like to extract the "calls" columns and store the count of the calls withrespect to the syscall. I …

Member Avatar for farhan69
0
181
Member Avatar for siga

Hi, I am given this assignment that should be run in Jython. The assignment says that the program consists of a Java application with a canvas and a textarea for turtle code. I need to create a Jython application that takes turtle code from the Java application, parses it with …

Member Avatar for vegaseat
0
942
Member Avatar for vegaseat
3
601
Member Avatar for Greyhelm

I have a strange problem, I have written a for loop to check a list of words for a match and it is not checking all of the words: I am using two files to check for matched words (Enwords.txt - a list of English words and Encontract.txt - a …

Member Avatar for Greyhelm
0
420
Member Avatar for longtomjr

I have been playing around a bit and I want to know if you can update a global varaible... rowA = [] def printSeat(): global rowA print "A", rowA = ['*', '*', '*', '*', '*', '*', '*', '*'] print rowA print "B", rowB = ['*', '*', '*', '*', '*', '*', …

Member Avatar for woooee
0
225
Member Avatar for Niner710

I want to convert a Pandas DataFrame series to a List. In [63]: bayFails Out[64]: 0 [0, 1, 4, 5, 6, 8, 9, 12, 13, 14] In [63]: type(bayFails) Out[64]: <class 'pandas.core.series.Series'> Can someone show me how to convert bayFails into a list?

Member Avatar for dashing.adamhughes
0
1K
Member Avatar for donkatsu

Hi, I'm new to Python and am having trouble with this. Here's my code: import urllib, urllib2, re import xml.etree.ElementTree as ET from bs4 import BeautifulSoup # The get_zipcode(address) function will be called with an address string with # no zip code, such as 'Lowell Observatory, Flagstaff, AZ', and it …

Member Avatar for donkatsu
0
281
Member Avatar for chinaexpert1

Hi Folks, My partner and I are experienced investment professionals with a background in mathematics. We are picking up Python now and we're gonna take this free online class from UC Berkeley on AI programming. We're looking for a third to join in our study group, contrast approaches, discuss topics, …

Member Avatar for TrustyTony
-1
254
Member Avatar for longtomjr

I am making a basic comand line program that does conversions in python and i want to add more conversions to it without scripting. so you can command the program something like (you command the PC) add new_conversion (The PC ask) name the new_conversion: *here you enter your function name* …

Member Avatar for ZZucker
0
216
Member Avatar for clouds_n_things

So my program is progressing quite nicely, and I'm semi-proud of myself for getting this far (I'm a newbie), but I had 2 questions. One question is that my program recognizes a .CFG extension...but never finds games with any other extension (.smc, .srm). I type it in EXACTLY as it …

Member Avatar for clouds_n_things
0
169
Member Avatar for wrathofmobius

(Just to preface this, I am a Python noob, so parts may be stupid/less obvious to me) I am trying to compile a Python script to exe, with the following setup.py file: from cx_Freeze import setup, Executable includes = ["re", "PyVMF"] setup( name="Wall Tile Randomizer", version="1.2", description="Wall Tile Randomizer", executables=[Executable("WallRandomizer.py")], …

Member Avatar for wrathofmobius
0
8K
Member Avatar for vegaseat

A small test program exploring the PySide/PyQT Label widget. With HTML code you can do some nice formatting of the label's text.

5
749
Member Avatar for romes87

Basically, I am trying to extract text between two strings within a loop as one of the two words changes after the information is extracted. so for example, the string is: string = alpha 111 bravo 222 alpha **somethingA** end, 333 bravo **somethingB** end 444 alpha 555 bravo So I …

Member Avatar for TrustyTony
0
251
Member Avatar for vegaseat

The PySide/PyQT QValidator restricts the type of input a widget like QLineEdit can accept. Here is a simple test.

1
715

The End.