761 Posted Topics

Member Avatar for Aiban

I'm not sure if tkinter has changed in py30 and above but shouldn't you be using [icode]awin.destroy[/icode] ?

Member Avatar for vegaseat
0
277
Member Avatar for mathijs

[QUOTE=mathijs;474400]i came up with this to print the field [code=python] list = [["-","-","-"],["-","-","-"],["-","-","-"]] def printschema(): for x in list: print x[0],x[1],x[2] printschema() o - - - - x - - - lijst[1][1]="o" printschema() o - - - o x - - - [/code] i put it into a list to …

Member Avatar for mathijs
0
136
Member Avatar for sravan953

[QUOTE=sravan953;929262]open the Sound Recorder, but how do I make it to [I]start recording[/I]?[/QUOTE] That's not the kind of thing that subprocess was intended for. That kind of behavior is more akin to win32 hooks. Subprocess can manipulate std input but not buttons on a GUI. As sneekula said, if the …

Member Avatar for Stefano Mtangoo
0
128
Member Avatar for dezza

[QUOTE=dezza;912231]Can you define this method? I am not sure I understand what you mean.[/QUOTE] Binary read is simply opening the file under the [B]mode[/B] 'read' plus 'binary'. Read up on the built-in [ICODE]open[/ICODE] method [URL="http://docs.python.org/library/functions.html#open"]here[/URL], and the answer will reveal itself.

Member Avatar for jlm699
0
375
Member Avatar for vegaseat

[QUOTE=jephthah;882066]but isnt 7 just a watered down Vista? i dont' know anyone who's especially excited about 7.[/QUOTE] No, it's a fixed Vista. I'm genuinely excited about 7. I had the beta and now am running the RC1 on my home desktop. It's fantastically amazing and is what Vista [I]should[/I] have …

Member Avatar for kaninelupus
0
637
Member Avatar for Your_mum

[QUOTE=Your_mum;928498][code]AdressBook = ['Eve', 'Bob', 'Mike', 'Tom', 'Jane'] for x in AdressBook: print x, '\n' f = open('C:\Documents and Settings\Henry\My Documents\Python_Stuff\Letter.txt', 'r+') for a in AdressBook: x = AdressBook.index(0) for i in f: print i % (x) AdressBook.pop(0) [/code]Confuzzled...[/QUOTE] I'm confuzzled by your code. Do you know what [ICODE]list.index(x)[/ICODE] does? It …

Member Avatar for Your_mum
0
105
Member Avatar for hughesadam_87

This isn't builtin, but my first hit on a google search for 'python list frequency' was [URL="http://snippets.dzone.com/posts/show/1629"]this[/URL]: [code=python] >>> alist = [ '1', '1', '2', '1', '3', '4', '1', '3'] >>> [(a, alist.count(a)) for a in set(alist)] [/code]

Member Avatar for jlm699
0
157
Member Avatar for TerabyteST

The line is static, it's not dynamic! What you can do is capture the resize event and simply adjust the width of the static line to the width of the window using something like getsize().

Member Avatar for jlm699
0
55
Member Avatar for sravan953

Refer to [URL="http://docs.python.org/library/subprocess.html#subprocess.call"]documentation here[/URL]. The first argument contains your arguments for the process itself so it needs to be a single element (list, tuple, etc). The remainder of parameters get passed to the Popen init function. [URL="http://docs.python.org/library/subprocess.html#subprocess.Popen"]Refer here [/URL]to the remainder of items you can pass using **kwargs.

Member Avatar for zachabesh
0
111
Member Avatar for pluring

Using your example string, we can separate at the whitespace using split(), and then locate the index of "welcome" using index(). Finally slicing the list by the result of index() + 1 will give us "to". Using it for finding a row of text x lines further should be a …

Member Avatar for pluring
0
105
Member Avatar for pythonbegginer

Firstly, you can use glob to get a list containing the name of each directory that starts with td like such: [icode]dirs = glob.glob(td.*)[/icode] You can find the [URL="http://docs.python.org/library/glob.html#module-glob"]documentation about glob here[/URL]. Next, you'll want to iterate over the list that glob returns by doing something along the lines of …

Member Avatar for pythonbegginer
0
187
Member Avatar for poeticinsanity

sys.argv provides you the string representation of cmd line params. 'True' and 'False' are both strings, and if a string has any content in it at all, the boolean representation is True. You should simply change your condition to [icode]if test.lower() == 'true':[/icode] HTH

Member Avatar for poeticinsanity
0
6K
Member Avatar for thenameisprayag

The important note about the above solution is that when calling SMTP() zachabesh initializes it to connect to gmail's smtp server ([icode]smtplib.SMTP("smtp.gmail.com", 0)[/icode]). Python's smtplib relies on you having access to an existing smtp server or else it cannot work. Alternately, you can initialize SMTP in the way that you …

Member Avatar for jlm699
0
838
Member Avatar for pongetti

As I interpret your package structure, your import should go something like this: [code=python] from package.subpackage1.baseclass import BaseClass class ClassA(BaseClass): pass [/code]

Member Avatar for jlm699
0
301
Member Avatar for sanju.d1231

All I can tell is that your expect strings never get found. So you would be better to figure out how to do this on the command line, and then replicate those actions using pexpect (since pexpect basically spoofs you performing the same commands (sendline) and waiting for certain responses …

Member Avatar for jlm699
0
200
Member Avatar for hughesadam_87

[QUOTE=shoemoodoshaloo;874126] How would you guys put that in laymen's terms? [icode]if not line.strip()[/icode][/QUOTE] I would translate it to: [icode]if empty line:[/icode] I guess. Here's an example, basically this code is relying on the fact that Python considers an empty string, or [icode]''[/icode] to be a False, while a non-empty string …

Member Avatar for tdeck
0
21K
Member Avatar for Norbert X

[QUOTE=Norbert X;819059]Keep getting an error about the tnls: [/QUOTE] Your indentation is off... starting with tnls on line 114 and again at 133 going down.

Member Avatar for Norbert X
0
645
Member Avatar for computerfreak

[QUOTE=computerfreak;873434]I can do that on the x-axis. ... I want it to be even along the x axis too, but I can't think of a way to do that [/QUOTE] Can you give more detail? Are you using a graphics toolkit? What type of interface are we talking here?

Member Avatar for shadwickman
0
198
Member Avatar for Davide Davin

[QUOTE=Davide Davin;915494]my problem is the content class because i can't pass self to this class imust pass parent but is not corret can somone help me[/QUOTE] Please clarify your question. What's "not correct"

Member Avatar for Davide Davin
0
183
Member Avatar for jimmy legend

[QUOTE=jimmy legend;918932]The tut's on the internet are a little complex.[/QUOTE] In that case threading is likely too complex for you. There's plenty of examples of threading on this site, if you'd take the time to search this particular forum. Also "open up 2 urls" is rather vague. You want to …

Member Avatar for jlm699
0
71
Member Avatar for princessotes

[QUOTE=princessotes;916804]thank s for the code. I have tried this but i keep getting the following error maxval=int(data[0]) ValueError: invalid literal for int() with base 10: '-0.0539723' However when i use float() instead, it works. Do you understand this error.[/QUOTE] '-0.0539723' is not a valid integer since it is not a …

Member Avatar for zachabesh
0
128
Member Avatar for denniskhor

[QUOTE=denniskhor;916508]i use pywinauto, so will be like tat... ur answer din point to my question...[/QUOTE] Your grammar is atrocious, therefore your question makes no sense. It is unlikely that anyone will be willing or able to answer it in its current form. I suggest revising your question and asking in …

Member Avatar for denniskhor
0
227
Member Avatar for zachabesh

Maybe as a sanity check print out the contents of [icode]ffmpeg_line[/icode] before calling the subprocess to make sure you've actually constructed the proper system call. Also, the shared computer... is it a different platform? What is the purpose of that setup? I could imagine if you were running a script …

Member Avatar for zachabesh
0
186
Member Avatar for dp_neo

The file [icode]Otickers.txt[/icode] is not in the working directory. Try printing the output of [icode]os.listdir('.')[/icode] to see what actually is in the directory, along with [icode]os.getcwd()[/icode] to see which directory you're actually working in. also, a major flaw in your code is that any exception caught within your try block …

Member Avatar for dp_neo
0
92
Member Avatar for vodkalove

This belongs in the Hardware/Software -> Networking forum... If you know how to use ssh to create tunnels go that route. If you don't know how to do that, search google for the numerous guides that exist.

Member Avatar for jlm699
0
92
Member Avatar for SpiritGeek

[QUOTE=SpiritGeek;915502] [CODE=python]class Validate_Numeric ( wx . PyValidator ): def __init__ ( Self ): wx . PyValidator . __init__ ( Self ) def Clone ( Self ): return Validate_Numeric () def On_Text_Change ( Self, Event ): TextCtrl = Self . GetWindow () Text = TextCtrl . GetValue () if Text . …

Member Avatar for jlm699
0
2K
Member Avatar for iliketacos
Member Avatar for vegaseat
0
117
Member Avatar for jlm699

I feel like I'm losing my mind... I uninstalled wxPython this morning and was going to reinstall with the latest version as I'm having peculiar problems with UliPad that I just downloaded yesterday. Well after uninstalling the wx package and docs & demos I went to the wxPython page and …

Member Avatar for vegaseat
0
221
Member Avatar for joe82

[QUOTE=wildgoose;906877]That will work as well. But close file then reopen it with the create upon open or you will merely be overwriting the existing file and have debris from the previous file at the end![/QUOTE] What wildgoose is trying to say here is make sure you open your new file …

Member Avatar for joe82
-1
179
Member Avatar for joe82

Here's how to open a file for reading and iterate over it: [code=python] f = open(my_file) for line in file: # Do something to each line f.close() [/code] Here's how to split a string : [code=python] >>> my_text = "Here'ssomeTExt WithSomeMoreOver Here and then some more" >>> my_text.split() ["Here'ssomeTExt", 'WithSomeMoreOver', …

Member Avatar for joe82
0
131
Member Avatar for clinton.havens

Many DELL versions of BIOS have a "backdoor" password to bypass this in MFG or troubleshooting environments. This backdoor password is Dell (or DELL). Give those a shot.

Member Avatar for clinton.havens
0
150
Member Avatar for johndoe444

What is your question exactly? [code=python] Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> print 'Rash\xf4mon' Rashômon >>> [/code]

Member Avatar for The_Kernel
0
168
Member Avatar for abbiejoy21

I think this is what you're looking for: [code=python] urllib.urlretrieve(url_of_file, destination_on_local_filesystem) [/code] Note this could vary depending on what version of Python you have. This is from 2.5... Other versions of python can use something like: [code=python]urllib.request.urlretrieve(url, local_file_name)[/code]

Member Avatar for jlm699
0
301
Member Avatar for kes_ee

[QUOTE=kes_ee;905234][CODE=perl]$str = HelloWorld; $str =~ s/[A-Z]/_$&/g; $str =~ s/^_//; $str = uc($str); print "$str";[/CODE][/QUOTE] This one's a little closer to your perl method: [code=python] import re text = re.sub(r'([A-Z]+)',lambda x:'_'+x.group(0).lower(),'HelloPythonWorld') text = re.sub(r'^_', r'', text) print text.upper()[/code]

Member Avatar for shadwickman
0
177
Member Avatar for johndoe444

[QUOTE=evstevemd;905237]what editor do you use? Get ulipad [url]http://code.google.com/p/ulipad/[/url][/QUOTE] How long have you known about this? And why haven't you told us until now?!

Member Avatar for jlm699
0
162
Member Avatar for Zetlin

Use sum [code=python] def test(): number = input("Number: ") return sum([count*20 for count in range(1, number+1)]) [/code]

Member Avatar for jlm699
0
113
Member Avatar for daviddoria

I think you'll probably need to make use of eval in this case: [code=python] >>> myLengths = [3, 8, 5] >>> for eachLength in myLengths: ... print eval("'%0" + str(eachLength) + "d' % 2") ... 002 00000002 00002 >>> [/code] Unless you're willing to split your above code into two …

Member Avatar for daviddoria
0
138
Member Avatar for GrimJack

How pitifully sad and pathetic of a cyborg name: J.L.M. - Journeying Lifelike Machine I have no purpose but to wander and appear lifelike? :( Haha, but this one's not too bad: J.I.M.M.Y. - Journeying Intelligent Machine Manufactured for Yelling Who would manufacture a machine just to yell?

Member Avatar for Sky Diploma
0
116
Member Avatar for tehbrozor

Running a script via [icode]python my_python.py cmd1 cmd2 cmd3[/icode] on the command line would produce the following argv structure: [code=python] import sys print sys.argv # Output: # ['my_python.py', 'cmd1', 'cmd2', 'cmd3'] [/code] HTH

Member Avatar for jlm699
0
172
Member Avatar for hughesadam_87

A simple, straightforward method would be to iterate over both files simultaneously and write their values into the output file with a tab separating them like so: [code=python] file1 = open( file_name1 ) file2 = open( file_name2 ) out_file = open( out_file_name, 'w' ) while 1: line1 = file1.readline() line2 …

Member Avatar for hughesadam_87
0
89
Member Avatar for harsha_kusam

Perhaps you should uninstall the cx_Oracle module and reinstall it, as it probably looks for the location of the current Oracle installation during setup. Make sure all references to the old 9i version are removed, including registry entries and all directories.

Member Avatar for harsha_kusam
0
253
Member Avatar for iliketacos

[QUOTE=iliketacos;903227] [code=python] def recordcomment(post): f=open('C:/commentlog.txt', 'a') f.write(post) f.write("\n") f.close() [/code][/QUOTE] It seems to me that you're trying to use the [ICODE]file.write()[/ICODE] method in the same manner as [ICODE]print[/ICODE]. correct me if I'm wrong, but you want a blank line (new line character [ICODE]\n[/ICODE]) in between each comment in the comments …

Member Avatar for iliketacos
0
260
Member Avatar for Aue

[QUOTE=sillyboy;782510]why is this in the python forum?[/QUOTE] Because he thinks we'll do his homework for him.

Member Avatar for leegeorg07
-1
1K
Member Avatar for wdsd

No, you're not using global variables correctly. Here's the correct way to use a global variable: [code=python] # This is the global scope my_var = 'Hi' def my_function( input ): # This is inside the function's scope global my_var # This pulls my_var into the scope of the function [/code] …

Member Avatar for BigTurtle
0
102
Member Avatar for pymatio

You'll need to be more clear. Define "the cookie bit". How about pasting your traceback.

Member Avatar for jlm699
0
74
Member Avatar for leegeorg07

You can use the HTML capabilities of wxPython and simply design the GUI... look into the docs and demos for examples of HTML usage

Member Avatar for leegeorg07
0
81
Member Avatar for sravan953

[QUOTE=sravan953;902113]Any more ideas on how I can shorten it?[/QUOTE] How about using slicing: [CODE=python]site_list= ['C', ':', '\', 'D', 'o', 'c', 'u', 'm', 'e', 'n', 't', 's', ' ', 'a', 'n', 'd', ' ', 'S', 'e', 't', 't', 'i', 'n', 'g', 's', '\', 'S', 'r', 'a', 'v', 'a', 'n', '\', 'M', …

Member Avatar for sravan953
0
117
Member Avatar for ckaiser813

> First of all, you don't have to do int(input()) because input() returns a number anyway. > > And you should start with better explaining the rest of the problem I think he's using python 3... That being said, we don't give homework help to those that don't show effort. …

Member Avatar for jlm699
0
126
Member Avatar for dude93
Member Avatar for vegaseat
0
114
Member Avatar for tomtetlaw

Refer [URL="http://docs.python.org/tutorial/modules.html#packages"]here[/URL] for details on how to make a "Package" taking advantage of __init__.py files... should get you going

Member Avatar for vegaseat
0
158

The End.