15,181 Topics

Member Avatar for
Member Avatar for 3e0jUn

How do you make Python set an str from a file? For example, my file would contain these pieces of text: username=Eugene password=eugene How do I get Python to return this? >>> print(username) Eugene >>> print(password) eugene Any help is deeply appreciated. Thanks!

Member Avatar for 3e0jUn
0
243
Member Avatar for fatalaccidents

Hey guys, I had a quick question. Let me try to explain what I'm trying to do here. I'm a bit new to numpy and I'm writing a parallelized code. It is working fine without the use of NumPy, but I'm trying to learn by getting it to work both …

Member Avatar for fatalaccidents
0
362
Member Avatar for napierin

Im brand new at python and am trying to teach myself through a book. Im trying to run a very simple command but I keep on getting a syntax error. If someone could take a look at it and tell me what im doing wrong I would greatly appreciate it. …

Member Avatar for napierin
0
233
Member Avatar for duckduck

I have been trying to create a text file and code it in UTF-8. I have managed to do it using codecs However, I am having trouble when I ask the user for input. Any ideas? # -*- coding: cp1252 -*- import codecs fileName = "testing1" textFile = codecs.open(fileName, "wt", …

Member Avatar for TrustyTony
0
137
Member Avatar for Arash-Sh

Hello im new in python and have a small project to do . my project is cms detector in python at first its in consol and does not has gui . because of im a newbie in programing i dont know how to begin the project . is there any …

Member Avatar for Arash-Sh
0
753
Member Avatar for heheja

Hey, Do any one know how to get only Lang ID from Google chrome site ("view-source:https://www.google.com/chrome?hl=en-GB") using this regex "<option value=""([a-zA-Z]*)"">[&#0-9; a-zA-Z()]*</option>" ?

Member Avatar for heheja
0
161
Member Avatar for matthewkeating

I am writing a script that solves a Quadratic equation. What I am doing wrong and why? The error I get is: [COLOR="Red"]Traceback (most recent call last): File "/home/matthew/Desktop/QuadraticSolver.py", line 5, in <module> c1 = (b * -1) + math.sqrt(((b*b) - 4*a*c) / 2*a) ValueError: math domain error[/COLOR] Here is …

Member Avatar for Gribouillis
0
609
Member Avatar for 3e0jUn

How do you make Python delete a specific line of text from a file? For example, delete_input = input ('> ') file = open('blahblah.$','w') #delete the variable delete_input file.delete(delete_input from file) Any form of help would be appreciated. Thanks!

Member Avatar for snippsat
0
81
Member Avatar for 3e0jUn

I have a very tough problem- how do you make an icon/character move across a console screen? For example, if I press W, +++++ ++E++ +++++ Then I press D +++++ +++E+ +++++ And I want it to be like the CHOICE command in CMD- Without requiring the user to …

Member Avatar for 3e0jUn
0
92
Member Avatar for Behseini

Hi, I am trying to create a simple GUI which let user to populate a list box base on a click event in wxpython. Can you please point me into a simple tutorial or example which has a sample? For example I have a list of colors: Red, Green, Blue, …

Member Avatar for Behseini
0
149
Member Avatar for HTMLperson5

Is there any way to remove an imported library? `Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32` `Type "copyright", "credits" or "license()" for more information.` `>>> dir()` `['__builtins__', '__doc__', '__name__', '__package__']` (Currently imported packages) `>>> import time` `>>> dir()` `['__builtins__', '__doc__', '__name__', '__package__', 'time']` …

Member Avatar for HiHe
0
409
Member Avatar for kwolfe

Hi, I'm a newbie to Python and trying to write my first FTP script. Here's the code: from ftplib import FTP ftp = FTP("LoginServer.com") ftp.login("LoginID", "Password") # open the file to read it f = open("C:/Users/MyDocs/Documents/Python/test.txt", "r") # Open directory ftp.cwd("/") # save file ftp.storbinary("STOR test.txt", f) ftp.quit() f.close() I'm …

Member Avatar for TrustyTony
0
198
Member Avatar for javanub123

im following along in this nifty little book and one of the coding examples just sparked my interest. data = open('some_file.txt') for each_line in data: print(each_line) How does python know what i want it to do without really telling it? i figured i would have to tell it how i …

Member Avatar for HiHe
0
149
Member Avatar for Zeref

Hi guys. So, I'm trying to read data from a database and displaying in a GtkTreeview. I used glade to design the GUI when i click on the button (view movies) the list of movies should display as a list. def on_btnmovies_clicked(self,widget,data=None): store=self.builder.get_object('listmovies') connect=sqlite.connect('movies.db') db=connect.cursor() db.execute("SELECT * FROM movie") for …

Member Avatar for Zeref
0
736
Member Avatar for Iceman10284

Assume that a file containing a series of names ( as strings ) is named names.dat and exists on the computers disk. Design a program that displays the numbers of names that are stored in the file. ( Hint: Open the file and read every string stored on it. Each …

Member Avatar for sepp2k
0
537
Member Avatar for chriswelborn

I started using Python a few weeks ago, something finally clicked and I started writing tools for my personal use. I started writing something with a GUI using GTK and the code lines started multiplying rapidly, so I thought to myself "Am I commenting my source to death? How many …

Member Avatar for chriswelborn
2
361
Member Avatar for javanub123

im trying to write a program that will read a line of text from a file and then print that text into whereever the cursor is in the browser. like into the address bar or something. is the possible with python? how would i go about doing it. i know …

Member Avatar for javanub123
0
119
Member Avatar for ceck30s

Hi, I'm a beginner at python and I'm trying to extract specific columns from a text file, and then use those columns to make a line plot. The files contains the following few lines of data: # Raw SIFs at Crack Propagation Step: 0 # Vertex, X, Y, Z, K_I, …

Member Avatar for Gribouillis
0
756
Member Avatar for KoRnKloWn

I am currently working on an app to convert documents (specifically Open Document Text, at least for now) to epub format. The problem I'm running into right now is this, I am using etree ElementTree to parse the xml files extracted from the .odt file, right now I'm working on …

Member Avatar for KoRnKloWn
0
272
Member Avatar for fatalaccidents

Hey guys, I'm new to parallel programming, so I was wondering if anyone could help me parallelize a bit of code. It is a code that goes into large h5 files (using h5py) and grabs some data out. After that the data has to be reformatted and printed into another …

0
88
Member Avatar for 3e0jUn

How do you make Python delete a string or a number (in this case, .0) from a file? Example: #Error Fixing if '.0' in open('ship.$','r'): #Delete the '.0'

Member Avatar for snippsat
0
482
Member Avatar for pn1925

I am trying to write a python script to open file, read each line, and replace the 18th position of each line with a a user specified character (sysargv[3]) IF AND ONLY IF that 18th position is another user specified character (sysargv[2]). It should then save it as a file …

Member Avatar for pn1925
0
146
Member Avatar for Trak

Hi :) i'm kind of new to this site and everytime I read a thread someone else makes i don't understand what anyone is saying.... :sad: well anyways, please help me python pros. I have been on my very first exercise of "Learn Pyhton the Hard Way" since two weeks …

Member Avatar for brikbrat
0
601
Member Avatar for 3e0jUn

Guys check out http://cx6-dev.blogspot.com/ for an awesome game coded in Python. It's new but still fun. HIGHLY RECOMMENDED! PS: You'll need to have Python 3.2 or above to install/play it.

0
75
Member Avatar for helpneeded87

Hello, I was seeking help in why my small program/script is not performing the way I would like. Here is the question. Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each …

Member Avatar for helpneeded87
0
243
Member Avatar for lrh9

I had been wanting to write an IRC bot with asynchronous IO for a while. My bot responds to pings, but can be extended by defining functions and registering them to get called when the bot receives certain commands. My bot uses the RFC 1459 USER command and parameters, but …

Member Avatar for lrh9
0
261
Member Avatar for TrustyTony

As in C++ was some question about speed of simple hard disk based lookup, here is a version of unscramble program completely HD based lookup, which gives all possible candidate words for multiword anagram. Program is not sensitive for case of words but does not ignore special characters like ' …

Member Avatar for svfox2000
0
1K
Member Avatar for chriswelborn

This is a script that was supposed to be very basic, just running a command with my scripts arguments attached. I didn't realize that if user 'cj' opens firefox, when user 'root' does '**firefox -new-tab**' it doesn't work. Firefox will just open a new window, and thats exactly what I …

Member Avatar for chriswelborn
0
308
Member Avatar for veledrom

Hi, I've started learning Python and want to find out how easy is creating GUI for a software. I used to use VB6 with Visual Studio and it was all about Drag and Drop items on a form. Do we have such thing or we just have to hand code …

Member Avatar for HiHe
0
2K
Member Avatar for 3e0jUn

I have a code for a game. money_file = open ('money.$','r').read() money_file = str(money_file) money = int(money_file) But everytime I run it, it returns an error: Traceback (most recent call last): File "C:\Users\eeo.j\Desktop\CX6 SDK\CX6 Normal\CX6.py", line 86, in <module> money = int(money_file) ValueError: invalid literal for int() with base 10: …

Member Avatar for HiHe
0
150

The End.